summaryrefslogtreecommitdiff
path: root/flake.nix
diff options
context:
space:
mode:
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix90
1 files changed, 65 insertions, 25 deletions
diff --git a/flake.nix b/flake.nix
index 816fd499..db0c6991 100644
--- a/flake.nix
+++ b/flake.nix
@@ -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 };
@@ -108,7 +108,7 @@
108 }; 108 };
109 nix-index-database = { 109 nix-index-database = {
110 type = "github"; 110 type = "github";
111 owner = "Mic92"; 111 owner = "nix-community";
112 repo = "nix-index-database"; 112 repo = "nix-index-database";
113 ref = "main"; 113 ref = "main";
114 inputs = { 114 inputs = {
@@ -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 = {
@@ -168,16 +186,6 @@
168 repo = "impermanence"; 186 repo = "impermanence";
169 ref = "master"; 187 ref = "master";
170 }; 188 };
171 waybar = {
172 type = "github";
173 owner = "gkleen";
174 repo = "Waybar";
175 ref = "feat/privacy-ignore";
176 inputs = {
177 nixpkgs.follows = "nixpkgs";
178 flake-compat.follows = "flake-compat";
179 };
180 };
181 nixVirt = { 189 nixVirt = {
182 type = "github"; 190 type = "github";
183 owner = "AshleyYakeley"; 191 owner = "AshleyYakeley";
@@ -189,6 +197,32 @@
189 owner = "sodiboo"; 197 owner = "sodiboo";
190 repo = "niri-flake"; 198 repo = "niri-flake";
191 ref = "main"; 199 ref = "main";
200 inputs = {
201 nixpkgs.follows = "nixpkgs";
202 niri-unstable = {
203 type = "github";
204 owner = "gkleen";
205 repo = "niri";
206 ref = "fix/locked-monitor-control";
207 };
208 };
209 };
210 nix-monitored = {
211 type = "github";
212 owner = "ners";
213 repo = "nix-monitored";
214 ref = "master";
215 inputs = {
216 nixpkgs.follows = "nixpkgs";
217 };
218 };
219 lanzaboote = {
220 type = "github";
221 owner = "nix-community";
222 repo = "lanzaboote";
223 ref = "v0.4.3";
224
225 inputs.nixpkgs.follows = "nixpkgs";
192 }; 226 };
193 }; 227 };
194 228
@@ -275,9 +309,10 @@
275 mkAccountModule = dir: path: accountName: 309 mkAccountModule = dir: path: accountName:
276 let 310 let
277 userName = accountUserName accountName; 311 userName = accountUserName accountName;
312 hostName = accountHostName accountName;
278 in overrideModule 313 in overrideModule
279 (import (dir + "/${path}")) 314 (import (dir + "/${path}"))
280 (inputs: inputs // { inherit userName; }) 315 (inputs: inputs // { inherit userName hostName; })
281 (outputs: { _file = dir + "/${path}"; } 316 (outputs: { _file = dir + "/${path}"; }
282 // outputs 317 // outputs
283 // { imports = [self.nixosModules.users.${userName} or ({...}: { imports = defaultUserProfiles userName; })] ++ (outputs.imports or []); }); 318 // { imports = [self.nixosModules.users.${userName} or ({...}: { imports = defaultUserProfiles userName; })] ++ (outputs.imports or []); });
@@ -293,7 +328,7 @@
293 forAllUsers = genAttrs (unique (map accountUserName (attrNames self.nixosModules.accounts))); 328 forAllUsers = genAttrs (unique (map accountUserName (attrNames self.nixosModules.accounts)));
294 329
295 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)); 330 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));
296 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; })); 331 # 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; }));
297 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)))); 332 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))));
298 installerShells = system: pkgs: mapAttrs (installerName: config: pkgs.callPackage ./installer/shell.nix { 333 installerShells = system: pkgs: mapAttrs (installerName: config: pkgs.callPackage ./installer/shell.nix {
299 inherit system installerName config; 334 inherit system installerName config;
@@ -330,18 +365,23 @@
330 nixosConfigurations = installerNixosConfigurations // nixImport rec { dir = ./hosts; _import = mkNixosConfiguration [] dir; }; 365 nixosConfigurations = installerNixosConfigurations // nixImport rec { dir = ./hosts; _import = mkNixosConfiguration [] dir; };
331 366
332 homeModules = nixImport rec { dir = ./home-modules; }; 367 homeModules = nixImport rec { dir = ./home-modules; };
333 homeConfigurations = listToAttrs (concatLists (mapAttrsToList (hostname: nixosConfig: mapAttrsToList (username: configuration: nameValuePair "${username}@${hostname}" { inherit (configuration.home) activationPackage; inherit (configuration) home-files; }) nixosConfig.config.home-manager.users) self.nixosConfigurations)); 368 homeConfigurations = listToAttrs (concatLists (mapAttrsToList (hostname: nixosConfig: mapAttrsToList (username: nameValuePair "${username}@${hostname}") nixosConfig.config.home-manager.users) self.nixosConfigurations));
334 369
335 overlays = mapAttrs (_name: path: mkOverlay path) overlayPaths; 370 overlays = mapAttrs (_name: path: mkOverlay path) overlayPaths;
336 371
337 packages = forAllSystems (system: systemPkgs: nixImport rec { dir = ./tools; _import = _path: name: import "${toString dir}/${name}" ({ inherit system; } // inputs); }); 372 packages = forAllSystems (system: systemPkgs: nixImport rec { dir = ./tools; _import = name: _base: import (dir + "/${name}") ({ inherit system; } // inputs); });
338 373
339 # packages = mapAttrs (_name: filterAttrs (_name: isDerivation)) packages; 374 # packages = mapAttrs (_name: filterAttrs (_name: isDerivation)) packages;
340 # packages' = mapAttrs (_name: filterAttrs (_name: value: !(isDerivation value))) packages; 375 # packages' = mapAttrs (_name: filterAttrs (_name: value: !(isDerivation value))) packages;
341 376
342 legacyPackages = forAllSystems (system: systemPkgs: systemPkgs.override { overlays = attrValues self.overlays; }); 377 legacyPackages = forAllSystems (system: systemPkgs: systemPkgs.override { overlays = attrValues self.overlays; });
343 378
344 apps = foldr recursiveUpdate {} [startVMs activateNixosConfigurations activateHomeManagerConfigurations]; 379 apps = foldr recursiveUpdate {} [
380 #startVMs
381 activateNixosConfigurations activateHomeManagerConfigurations
382 ];
383
384 lib = nixImport rec { dir = ./lib; _import = name: _base: import (dir + "/${name}") inputs; };
345 385
346 devShells = forAllSystems (system: systemPkgs: { default = import ./shell.nix ({ inherit system; } // inputs); } // installerShells system systemPkgs); 386 devShells = forAllSystems (system: systemPkgs: { default = import ./shell.nix ({ inherit system; } // inputs); } // installerShells system systemPkgs);
347 387
@@ -366,10 +406,10 @@
366 # path = activateHomeManager (self.nixosConfigurations.${hostname}.config.nixpkgs.system) usercfg.home; 406 # path = activateHomeManager (self.nixosConfigurations.${hostname}.config.nixpkgs.system) usercfg.home;
367 # }) self.nixosConfigurations.${hostname}.config.home-manager.users); 407 # }) self.nixosConfigurations.${hostname}.config.home-manager.users);
368 }) (nixImport { dir = ./hosts; _import = (_path: name: name); }); 408 }) (nixImport { dir = ./hosts; _import = (_path: name: name); });
369 overrides = if pathExists ./deploy then nixImport { dir = ./deploy; _import = path: _name: import (./deploy + "/${path}") inputs; } else {}; 409 overrides = if pathExists ./deploy then nixImport rec { dir = ./deploy; _import = path: _name: import (dir + "/${path}") inputs; } else {};
370 filterEnabled = attrs: mapAttrs (_n: v: filterAttrs (n: _v: n != "enabled") v) (filterAttrs (_n: v: v.enabled or true) attrs); 410 filterEnabled = attrs: mapAttrs (_n: v: filterAttrs (n: _v: n != "enabled") v) (filterAttrs (_n: v: v.enabled or true) attrs);
371 in mapAttrs (_n: v: if v ? "profiles" then v // { profiles = filterEnabled v.profiles; } else v) (filterEnabled (recursiveUpdate defaults overrides)); 411 in mapAttrs (_n: v: if v ? "profiles" then v // { profiles = filterEnabled v.profiles; } else v) (filterEnabled (recursiveUpdate defaults overrides));
372 412
373 checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib; 413 # checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib;
374 }; 414 };
375} 415}