-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
147 lines (140 loc) · 4.59 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
{
description = "my dots";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nixos-hardware.url = "github:NixOS/nixos-hardware";
flake-utils.url = "github:numtide/flake-utils";
lix-module = {
url = "https://git.lix.systems/lix-project/nixos-module/archive/2.91.1-2.tar.gz";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
deploy-rs = {
url = "github:serokell/deploy-rs";
inputs.nixpkgs.follows = "nixpkgs";
};
spicetify-nix = {
url = "github:Gerg-L/spicetify-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
wayland-pipewire-idle-inhibit = {
url = "github:rafaelrc7/wayland-pipewire-idle-inhibit";
inputs.nixpkgs.follows = "nixpkgs";
};
# 6.0.2 4680; last known working zoom w/ screen-sharing
nixpkgs-zoom.url = "github:NixOS/nixpkgs/06031e8a5d9d5293c725a50acf0124219363502";
spotify-cleanup = {
url = "github:svrana/spotify-cleanup";
#url = "git+file:///home/shaw/Projects/spotify-cleanup";
inputs.nixpkgs.follows = "nixpkgs";
};
neorg-overlay = {
url = "github:nvim-neorg/nixpkgs-neorg-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{ self
, nixpkgs
, lix-module
, flake-utils
, deploy-rs
, home-manager
, neorg-overlay
, ... } @inputs:
let
inherit (nixpkgs.lib) nixosSystem;
inherit (builtins) readDir mapAttrs;
lib = nixpkgs.lib;
nixpkgsConfig = {
config = {
allowUnfree = true;
allowUnfreePredicate = (pkgs: true);
};
overlays = builtins.attrValues self.overlays;
};
mkSystem = extraModules: nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit inputs; };
modules = [
lix-module.nixosModules.default
({ config, ... }: {
system.configurationRevision = self.sourceInfo.rev;
services.getty.greetingLine =
"<<< Welcome to NixOS ${config.system.nixos.label} @ ${lib.substring 0 7 self.sourceInfo.rev} - \\l >>>";
})
{ nixpkgs.overlays = nixpkgsConfig.overlays; }
] ++ extraModules;
};
mkHome = extraModules: home-manager.lib.homeManagerConfiguration {
pkgs = import nixpkgs {
system = "x86_64-linux";
inherit (nixpkgsConfig) config overlays;
};
modules = [
modules/my.nix
inputs.wayland-pipewire-idle-inhibit.homeModules.default
inputs.spotify-cleanup.homeModules.default
] ++ extraModules;
extraSpecialArgs = { inherit inputs; };
};
in
(
flake-utils.lib.eachDefaultSystem
(system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
devShells.default= pkgs.mkShell {
name = "dots";
buildInputs = [
deploy-rs.packages.${system}.deploy-rs
(import home-manager { inherit pkgs; }).home-manager
];
};
})
//
{
nixosConfigurations = {
prentiss = mkSystem [ ./hosts/prentiss/configuration.nix ];
bocana = mkSystem [ ./hosts/bocana/configuration.nix ];
park = mkSystem [ ./hosts/park/configuration.nix ];
};
homeConfigurations = {
prentiss = mkHome [ ./hosts/prentiss ];
park = mkHome [ ./hosts/park ];
};
overlays = with lib;
let
overlayFiles' = filter (hasSuffix ".nix") (attrNames (readDir ./overlays));
overlayFiles = listToAttrs (map
(name: {
name = removeSuffix ".nix" name;
value = import (./overlays + "/${name}");
})
overlayFiles');
in
overlayFiles // {
neorg-overlay = neorg-overlay.overlays.default;
};
# deploy '.#bocana'
deploy.nodes.bocana = {
hostname = "bocana";
autoRollback = false;
sshUser = "root";
magicRollback = false;
fastConnection = true;
profiles.system = {
user = "root";
path = deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.bocana;
};
};
# This is highly advised, and will prevent many possible mistakes
checks = mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib;
}
);
}