diff options
Diffstat (limited to 'flake.nix')
-rw-r--r-- | flake.nix | 83 |
1 files changed, 63 insertions, 20 deletions
@@ -4,20 +4,20 @@ | |||
4 | nixConfig = { | 4 | nixConfig = { |
5 | extra-substituters = [ | 5 | extra-substituters = [ |
6 | "https://nix-community.cachix.org" | 6 | "https://nix-community.cachix.org" |
7 | "https://niri.cachix.org" | ||
7 | ]; | 8 | ]; |
8 | extra-trusted-public-keys = [ | 9 | extra-trusted-public-keys = [ |
9 | "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" | 10 | "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" |
11 | "niri.cachix.org-1:Wv0OmO7PsuocRKzfDoJ3mulSl7Z6oezYhGhR+3W2964=" | ||
10 | ]; | 12 | ]; |
11 | }; | 13 | }; |
12 | 14 | ||
13 | inputs = { | 15 | inputs = { |
14 | nixpkgs = { | 16 | nixpkgs = { |
15 | type = "github"; | 17 | type = "github"; |
16 | # owner = "NixOS"; | 18 | owner = "NixOS"; |
17 | repo = "nixpkgs"; | 19 | repo = "nixpkgs"; |
18 | # ref = "nixos-unstable"; | 20 | ref = "nixos-unstable"; |
19 | owner = "gkleen"; | ||
20 | ref = "fix/matrix-synapse"; | ||
21 | }; | 21 | }; |
22 | nixpkgs-pgbackrest = { | 22 | nixpkgs-pgbackrest = { |
23 | type = "github"; | 23 | type = "github"; |
@@ -29,13 +29,13 @@ | |||
29 | type = "github"; | 29 | type = "github"; |
30 | owner = "NixOS"; | 30 | owner = "NixOS"; |
31 | repo = "nixpkgs"; | 31 | repo = "nixpkgs"; |
32 | ref = "24.05"; | 32 | ref = "25.05"; |
33 | }; | 33 | }; |
34 | nixpkgs-eostre = { | 34 | nixpkgs-eostre = { |
35 | type = "github"; | 35 | type = "github"; |
36 | owner = "NixOS"; | 36 | owner = "NixOS"; |
37 | repo = "nixpkgs"; | 37 | repo = "nixpkgs"; |
38 | ref = "23.11"; | 38 | ref = "25.05"; |
39 | }; | 39 | }; |
40 | home-manager = { | 40 | home-manager = { |
41 | type = "github"; | 41 | type = "github"; |
@@ -53,7 +53,7 @@ | |||
53 | type = "github"; | 53 | type = "github"; |
54 | owner = "gkleen"; | 54 | owner = "gkleen"; |
55 | repo = "home-manager"; | 55 | repo = "home-manager"; |
56 | ref = "nixos-late-start-23.11"; | 56 | ref = "nixos-late-start-25.05"; |
57 | inputs = { | 57 | inputs = { |
58 | nixpkgs.follows = "nixpkgs-eostre"; | 58 | nixpkgs.follows = "nixpkgs-eostre"; |
59 | }; | 59 | }; |
@@ -125,25 +125,43 @@ | |||
125 | nixpkgs.follows = "nixpkgs"; | 125 | nixpkgs.follows = "nixpkgs"; |
126 | }; | 126 | }; |
127 | }; | 127 | }; |
128 | pyproject-nix = { | ||
129 | url = "github:pyproject-nix/pyproject.nix"; | ||
130 | inputs.nixpkgs.follows = "nixpkgs"; | ||
131 | }; | ||
132 | uv2nix = { | ||
133 | url = "github:pyproject-nix/uv2nix"; | ||
134 | inputs.pyproject-nix.follows = "pyproject-nix"; | ||
135 | inputs.nixpkgs.follows = "nixpkgs"; | ||
136 | }; | ||
137 | pyproject-build-systems = { | ||
138 | url = "github:pyproject-nix/build-system-pkgs"; | ||
139 | inputs.pyproject-nix.follows = "pyproject-nix"; | ||
140 | inputs.uv2nix.follows = "uv2nix"; | ||
141 | inputs.nixpkgs.follows = "nixpkgs"; | ||
142 | }; | ||
128 | 143 | ||
129 | ca-util = { | 144 | ca-util = { |
130 | type = "gitlab"; | 145 | type = "gitlab"; |
131 | owner = "gkleen"; | 146 | owner = "gkleen"; |
132 | repo = "ca"; | 147 | repo = "ca"; |
133 | ref = "v3.1.3"; | 148 | ref = "v3.1.5"; |
134 | inputs = { | 149 | inputs = { |
150 | pyproject-nix.follows = "pyproject-nix"; | ||
151 | uv2nix.follows = "uv2nix"; | ||
135 | nixpkgs.follows = "nixpkgs"; | 152 | nixpkgs.follows = "nixpkgs"; |
136 | poetry2nix.follows = "poetry2nix"; | ||
137 | }; | 153 | }; |
138 | }; | 154 | }; |
139 | backup-utils = { | 155 | backup-utils = { |
140 | type = "gitlab"; | 156 | type = "gitlab"; |
141 | owner = "gkleen"; | 157 | owner = "gkleen"; |
142 | repo = "backup-utils"; | 158 | repo = "backup-utils"; |
143 | ref = "v0.1.6"; | 159 | ref = "v0.1.7"; |
144 | inputs = { | 160 | inputs = { |
145 | nixpkgs.follows = "nixpkgs"; | 161 | nixpkgs.follows = "nixpkgs"; |
146 | poetry2nix.follows = "poetry2nix"; | 162 | pyproject-nix.follows = "pyproject-nix"; |
163 | uv2nix.follows = "uv2nix"; | ||
164 | pyproject-build-systems.follows = "pyproject-build-systems"; | ||
147 | }; | 165 | }; |
148 | }; | 166 | }; |
149 | prometheus-borg-exporter = { | 167 | prometheus-borg-exporter = { |
@@ -172,7 +190,7 @@ | |||
172 | type = "github"; | 190 | type = "github"; |
173 | owner = "gkleen"; | 191 | owner = "gkleen"; |
174 | repo = "Waybar"; | 192 | repo = "Waybar"; |
175 | ref = "feat/privacy-ignore"; | 193 | ref = "feat/niri-urgency"; |
176 | inputs = { | 194 | inputs = { |
177 | nixpkgs.follows = "nixpkgs"; | 195 | nixpkgs.follows = "nixpkgs"; |
178 | flake-compat.follows = "flake-compat"; | 196 | flake-compat.follows = "flake-compat"; |
@@ -184,9 +202,28 @@ | |||
184 | repo = "NixVirt"; | 202 | repo = "NixVirt"; |
185 | inputs.nixpkgs.follows = "nixpkgs"; | 203 | inputs.nixpkgs.follows = "nixpkgs"; |
186 | }; | 204 | }; |
205 | niri-flake = { | ||
206 | type = "github"; | ||
207 | owner = "sodiboo"; | ||
208 | repo = "niri-flake"; | ||
209 | ref = "main"; | ||
210 | inputs = { | ||
211 | nixpkgs.follows = "nixpkgs"; | ||
212 | # niri-unstable.url = "github:gkleen/niri"; | ||
213 | }; | ||
214 | }; | ||
215 | nix-monitored = { | ||
216 | type = "github"; | ||
217 | owner = "ners"; | ||
218 | repo = "nix-monitored"; | ||
219 | ref = "master"; | ||
220 | inputs = { | ||
221 | nixpkgs.follows = "nixpkgs"; | ||
222 | }; | ||
223 | }; | ||
187 | }; | 224 | }; |
188 | 225 | ||
189 | outputs = { self, nixpkgs, home-manager, sops-nix, deploy-rs, nvfetcher, ... }@inputs: | 226 | outputs = { self, nixpkgs, home-manager, sops-nix, deploy-rs, nvfetcher, niri-flake, ... }@inputs: |
190 | let | 227 | let |
191 | inherit (builtins) attrNames attrValues elemAt toJSON isNull pathExists; | 228 | inherit (builtins) attrNames attrValues elemAt toJSON isNull pathExists; |
192 | inherit (nixpkgs) lib; | 229 | inherit (nixpkgs) lib; |
@@ -269,9 +306,10 @@ | |||
269 | mkAccountModule = dir: path: accountName: | 306 | mkAccountModule = dir: path: accountName: |
270 | let | 307 | let |
271 | userName = accountUserName accountName; | 308 | userName = accountUserName accountName; |
309 | hostName = accountHostName accountName; | ||
272 | in overrideModule | 310 | in overrideModule |
273 | (import (dir + "/${path}")) | 311 | (import (dir + "/${path}")) |
274 | (inputs: inputs // { inherit userName; }) | 312 | (inputs: inputs // { inherit userName hostName; }) |
275 | (outputs: { _file = dir + "/${path}"; } | 313 | (outputs: { _file = dir + "/${path}"; } |
276 | // outputs | 314 | // outputs |
277 | // { imports = [self.nixosModules.users.${userName} or ({...}: { imports = defaultUserProfiles userName; })] ++ (outputs.imports or []); }); | 315 | // { imports = [self.nixosModules.users.${userName} or ({...}: { imports = defaultUserProfiles userName; })] ++ (outputs.imports or []); }); |
@@ -287,7 +325,7 @@ | |||
287 | forAllUsers = genAttrs (unique (map accountUserName (attrNames self.nixosModules.accounts))); | 325 | forAllUsers = genAttrs (unique (map accountUserName (attrNames self.nixosModules.accounts))); |
288 | 326 | ||
289 | activateNixosConfigurations = forAllSystems (system: _pkgs: filterAttrs (_n: v: v != null) (mapAttrs' (hostName: nixosConfig: nameValuePair "${hostName}-activate" (if system == nixosConfig.config.nixpkgs.system then { type = "app"; program = "${nixosConfig.config.system.build.toplevel}/bin/switch-to-configuration"; } else null)) self.nixosConfigurations)); | 327 | activateNixosConfigurations = forAllSystems (system: _pkgs: filterAttrs (_n: v: v != null) (mapAttrs' (hostName: nixosConfig: nameValuePair "${hostName}-activate" (if system == nixosConfig.config.nixpkgs.system then { type = "app"; program = "${nixosConfig.config.system.build.toplevel}/bin/switch-to-configuration"; } else null)) self.nixosConfigurations)); |
290 | startVMs = forAllSystems (system: pkgs: mapAttrs' (hostName: nixosConfig: nameValuePair "run-${hostName}-vm" { type = "app"; program = "${nixosConfig.config.system.build.vm}/bin/run-${hostName}-vm"; }) (nixImport rec { dir = ./hosts; _import = mkNixosConfiguration [ { config.virtualisation.host.pkgs = pkgs; } ] dir; })); | 328 | # startVMs = forAllSystems (system: pkgs: mapAttrs' (hostName: nixosConfig: nameValuePair "run-${hostName}-vm" { type = "app"; program = "${nixosConfig.config.system.build.vm}/bin/run-${hostName}-vm"; }) (nixImport rec { dir = ./hosts; _import = mkNixosConfiguration [ { config.virtualisation.host.pkgs = pkgs; } ] dir; })); |
291 | activateHomeManagerConfigurations = forAllSystems (system: _pkgs: filterAttrs (_n: v: v != null) (listToAttrs (concatLists (mapAttrsToList (hostName: nixosConfig: mapAttrsToList (userName: userCfg: nameValuePair "${userName}@${hostName}-activate" (if system == nixosConfig.config.nixpkgs.system then { type = "app"; program = "${userCfg.home.activationPackage}/activate"; } else null)) nixosConfig.config.home-manager.users) self.nixosConfigurations)))); | 329 | activateHomeManagerConfigurations = forAllSystems (system: _pkgs: filterAttrs (_n: v: v != null) (listToAttrs (concatLists (mapAttrsToList (hostName: nixosConfig: mapAttrsToList (userName: userCfg: nameValuePair "${userName}@${hostName}-activate" (if system == nixosConfig.config.nixpkgs.system then { type = "app"; program = "${userCfg.home.activationPackage}/activate"; } else null)) nixosConfig.config.home-manager.users) self.nixosConfigurations)))); |
292 | installerShells = system: pkgs: mapAttrs (installerName: config: pkgs.callPackage ./installer/shell.nix { | 330 | installerShells = system: pkgs: mapAttrs (installerName: config: pkgs.callPackage ./installer/shell.nix { |
293 | inherit system installerName config; | 331 | inherit system installerName config; |
@@ -324,18 +362,23 @@ | |||
324 | nixosConfigurations = installerNixosConfigurations // nixImport rec { dir = ./hosts; _import = mkNixosConfiguration [] dir; }; | 362 | nixosConfigurations = installerNixosConfigurations // nixImport rec { dir = ./hosts; _import = mkNixosConfiguration [] dir; }; |
325 | 363 | ||
326 | homeModules = nixImport rec { dir = ./home-modules; }; | 364 | homeModules = nixImport rec { dir = ./home-modules; }; |
327 | homeConfigurations = listToAttrs (concatLists (mapAttrsToList (hostname: nixosConfig: mapAttrsToList (username: configuration: nameValuePair "${username}@${hostname}" { inherit (configuration.home) activationPackage; }) nixosConfig.config.home-manager.users) self.nixosConfigurations)); | 365 | homeConfigurations = listToAttrs (concatLists (mapAttrsToList (hostname: nixosConfig: mapAttrsToList (username: nameValuePair "${username}@${hostname}") nixosConfig.config.home-manager.users) self.nixosConfigurations)); |
328 | 366 | ||
329 | overlays = mapAttrs (_name: path: mkOverlay path) overlayPaths; | 367 | overlays = mapAttrs (_name: path: mkOverlay path) overlayPaths; |
330 | 368 | ||
331 | packages = forAllSystems (system: systemPkgs: nixImport rec { dir = ./tools; _import = _path: name: import "${toString dir}/${name}" ({ inherit system; } // inputs); }); | 369 | packages = forAllSystems (system: systemPkgs: nixImport rec { dir = ./tools; _import = name: _base: import (dir + "/${name}") ({ inherit system; } // inputs); }); |
332 | 370 | ||
333 | # packages = mapAttrs (_name: filterAttrs (_name: isDerivation)) packages; | 371 | # packages = mapAttrs (_name: filterAttrs (_name: isDerivation)) packages; |
334 | # packages' = mapAttrs (_name: filterAttrs (_name: value: !(isDerivation value))) packages; | 372 | # packages' = mapAttrs (_name: filterAttrs (_name: value: !(isDerivation value))) packages; |
335 | 373 | ||
336 | legacyPackages = forAllSystems (system: systemPkgs: systemPkgs.override { overlays = attrValues self.overlays; }); | 374 | legacyPackages = forAllSystems (system: systemPkgs: systemPkgs.override { overlays = attrValues self.overlays; }); |
337 | 375 | ||
338 | apps = foldr recursiveUpdate {} [startVMs activateNixosConfigurations activateHomeManagerConfigurations]; | 376 | apps = foldr recursiveUpdate {} [ |
377 | #startVMs | ||
378 | activateNixosConfigurations activateHomeManagerConfigurations | ||
379 | ]; | ||
380 | |||
381 | lib = nixImport rec { dir = ./lib; _import = name: _base: import (dir + "/${name}") inputs; }; | ||
339 | 382 | ||
340 | devShells = forAllSystems (system: systemPkgs: { default = import ./shell.nix ({ inherit system; } // inputs); } // installerShells system systemPkgs); | 383 | devShells = forAllSystems (system: systemPkgs: { default = import ./shell.nix ({ inherit system; } // inputs); } // installerShells system systemPkgs); |
341 | 384 | ||
@@ -360,10 +403,10 @@ | |||
360 | # path = activateHomeManager (self.nixosConfigurations.${hostname}.config.nixpkgs.system) usercfg.home; | 403 | # path = activateHomeManager (self.nixosConfigurations.${hostname}.config.nixpkgs.system) usercfg.home; |
361 | # }) self.nixosConfigurations.${hostname}.config.home-manager.users); | 404 | # }) self.nixosConfigurations.${hostname}.config.home-manager.users); |
362 | }) (nixImport { dir = ./hosts; _import = (_path: name: name); }); | 405 | }) (nixImport { dir = ./hosts; _import = (_path: name: name); }); |
363 | overrides = if pathExists ./deploy then nixImport { dir = ./deploy; _import = path: _name: import (./deploy + "/${path}") inputs; } else {}; | 406 | overrides = if pathExists ./deploy then nixImport rec { dir = ./deploy; _import = path: _name: import (dir + "/${path}") inputs; } else {}; |
364 | filterEnabled = attrs: mapAttrs (_n: v: filterAttrs (n: _v: n != "enabled") v) (filterAttrs (_n: v: v.enabled or true) attrs); | 407 | filterEnabled = attrs: mapAttrs (_n: v: filterAttrs (n: _v: n != "enabled") v) (filterAttrs (_n: v: v.enabled or true) attrs); |
365 | in mapAttrs (_n: v: if v ? "profiles" then v // { profiles = filterEnabled v.profiles; } else v) (filterEnabled (recursiveUpdate defaults overrides)); | 408 | in mapAttrs (_n: v: if v ? "profiles" then v // { profiles = filterEnabled v.profiles; } else v) (filterEnabled (recursiveUpdate defaults overrides)); |
366 | 409 | ||
367 | checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib; | 410 | # checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib; |
368 | }; | 411 | }; |
369 | } | 412 | } |