summaryrefslogtreecommitdiff
path: root/flake.nix
diff options
context:
space:
mode:
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix114
1 files changed, 88 insertions, 26 deletions
diff --git a/flake.nix b/flake.nix
index cd50543e..8a230dd2 100644
--- a/flake.nix
+++ b/flake.nix
@@ -4,9 +4,11 @@
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
@@ -27,13 +29,13 @@
27 type = "github"; 29 type = "github";
28 owner = "NixOS"; 30 owner = "NixOS";
29 repo = "nixpkgs"; 31 repo = "nixpkgs";
30 ref = "24.05"; 32 ref = "25.05";
31 }; 33 };
32 nixpkgs-eostre = { 34 nixpkgs-eostre = {
33 type = "github"; 35 type = "github";
34 owner = "NixOS"; 36 owner = "NixOS";
35 repo = "nixpkgs"; 37 repo = "nixpkgs";
36 ref = "23.11"; 38 ref = "25.05";
37 }; 39 };
38 home-manager = { 40 home-manager = {
39 type = "github"; 41 type = "github";
@@ -51,7 +53,7 @@
51 type = "github"; 53 type = "github";
52 owner = "gkleen"; 54 owner = "gkleen";
53 repo = "home-manager"; 55 repo = "home-manager";
54 ref = "nixos-late-start-23.11"; 56 ref = "nixos-late-start-25.05";
55 inputs = { 57 inputs = {
56 nixpkgs.follows = "nixpkgs-eostre"; 58 nixpkgs.follows = "nixpkgs-eostre";
57 }; 59 };
@@ -106,7 +108,7 @@
106 }; 108 };
107 nix-index-database = { 109 nix-index-database = {
108 type = "github"; 110 type = "github";
109 owner = "Mic92"; 111 owner = "nix-community";
110 repo = "nix-index-database"; 112 repo = "nix-index-database";
111 ref = "main"; 113 ref = "main";
112 inputs = { 114 inputs = {
@@ -123,35 +125,62 @@
123 nixpkgs.follows = "nixpkgs"; 125 nixpkgs.follows = "nixpkgs";
124 }; 126 };
125 }; 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 };
143 gitignore = {
144 type = "github";
145 owner = "hercules-ci";
146 repo = "gitignore.nix";
147 inputs.nixpkgs.follows = "nixpkgs";
148 };
126 149
127 ca-util = { 150 ca-util = {
128 type = "gitlab"; 151 type = "gitlab";
129 owner = "gkleen"; 152 owner = "gkleen";
130 repo = "ca"; 153 repo = "ca";
131 ref = "v3.1.3"; 154 ref = "v3.1.5";
132 inputs = { 155 inputs = {
156 pyproject-nix.follows = "pyproject-nix";
157 uv2nix.follows = "uv2nix";
133 nixpkgs.follows = "nixpkgs"; 158 nixpkgs.follows = "nixpkgs";
134 poetry2nix.follows = "poetry2nix";
135 }; 159 };
136 }; 160 };
137 backup-utils = { 161 backup-utils = {
138 type = "gitlab"; 162 type = "gitlab";
139 owner = "gkleen"; 163 owner = "gkleen";
140 repo = "backup-utils"; 164 repo = "backup-utils";
141 ref = "v0.1.6"; 165 ref = "v0.1.7";
142 inputs = { 166 inputs = {
143 nixpkgs.follows = "nixpkgs"; 167 nixpkgs.follows = "nixpkgs";
144 poetry2nix.follows = "poetry2nix"; 168 pyproject-nix.follows = "pyproject-nix";
169 uv2nix.follows = "uv2nix";
170 pyproject-build-systems.follows = "pyproject-build-systems";
145 }; 171 };
146 }; 172 };
147 prometheus-borg-exporter = { 173 prometheus-borg-exporter = {
148 type = "gitlab"; 174 type = "gitlab";
149 owner = "gkleen"; 175 owner = "gkleen";
150 repo = "prometheus-borg-exporter"; 176 repo = "prometheus-borg-exporter";
151 ref = "main"; 177 ref = "v1.1.1";
152 inputs = { 178 inputs = {
153 nixpkgs.follows = "nixpkgs"; 179 nixpkgs.follows = "nixpkgs";
154 poetry2nix.follows = "poetry2nix"; 180 pyproject-nix.follows = "pyproject-nix";
181 uv2nix.follows = "uv2nix";
182 pyproject-build-systems.follows = "pyproject-build-systems";
183 gitignore.follows = "gitignore";
155 }; 184 };
156 }; 185 };
157 nixos-hardware = { 186 nixos-hardware = {
@@ -166,25 +195,52 @@
166 repo = "impermanence"; 195 repo = "impermanence";
167 ref = "master"; 196 ref = "master";
168 }; 197 };
169 waybar = { 198 nixVirt = {
170 type = "github"; 199 type = "github";
171 owner = "gkleen"; 200 owner = "AshleyYakeley";
172 repo = "Waybar"; 201 repo = "NixVirt";
173 ref = "feat/privacy-ignore"; 202 inputs.nixpkgs.follows = "nixpkgs";
203 };
204 niri-flake = {
205 type = "github";
206 owner = "sodiboo";
207 repo = "niri-flake";
208 ref = "main";
174 inputs = { 209 inputs = {
175 nixpkgs.follows = "nixpkgs"; 210 nixpkgs.follows = "nixpkgs";
176 flake-compat.follows = "flake-compat"; 211 niri-unstable = {
212 type = "github";
213 owner = "gkleen";
214 repo = "niri";
215 ref = "fix/locked-monitor-control";
216 };
177 }; 217 };
178 }; 218 };
179 nixVirt = { 219 nix-monitored = {
180 type = "github"; 220 type = "github";
181 owner = "AshleyYakeley"; 221 owner = "ners";
182 repo = "NixVirt"; 222 repo = "nix-monitored";
223 ref = "master";
224 inputs = {
225 nixpkgs.follows = "nixpkgs";
226 };
227 };
228 lanzaboote = {
229 type = "github";
230 owner = "nix-community";
231 repo = "lanzaboote";
232 ref = "v0.4.3";
233
234 inputs.nixpkgs.follows = "nixpkgs";
235 };
236 niri-autoselect-portal = {
237 url = "git+https://codeberg.org/debugloop/niri-autoselect-portal.git";
238
183 inputs.nixpkgs.follows = "nixpkgs"; 239 inputs.nixpkgs.follows = "nixpkgs";
184 }; 240 };
185 }; 241 };
186 242
187 outputs = { self, nixpkgs, home-manager, sops-nix, deploy-rs, nvfetcher, ... }@inputs: 243 outputs = { self, nixpkgs, home-manager, sops-nix, deploy-rs, nvfetcher, niri-flake, ... }@inputs:
188 let 244 let
189 inherit (builtins) attrNames attrValues elemAt toJSON isNull pathExists; 245 inherit (builtins) attrNames attrValues elemAt toJSON isNull pathExists;
190 inherit (nixpkgs) lib; 246 inherit (nixpkgs) lib;
@@ -267,9 +323,10 @@
267 mkAccountModule = dir: path: accountName: 323 mkAccountModule = dir: path: accountName:
268 let 324 let
269 userName = accountUserName accountName; 325 userName = accountUserName accountName;
326 hostName = accountHostName accountName;
270 in overrideModule 327 in overrideModule
271 (import (dir + "/${path}")) 328 (import (dir + "/${path}"))
272 (inputs: inputs // { inherit userName; }) 329 (inputs: inputs // { inherit userName hostName; })
273 (outputs: { _file = dir + "/${path}"; } 330 (outputs: { _file = dir + "/${path}"; }
274 // outputs 331 // outputs
275 // { imports = [self.nixosModules.users.${userName} or ({...}: { imports = defaultUserProfiles userName; })] ++ (outputs.imports or []); }); 332 // { imports = [self.nixosModules.users.${userName} or ({...}: { imports = defaultUserProfiles userName; })] ++ (outputs.imports or []); });
@@ -285,7 +342,7 @@
285 forAllUsers = genAttrs (unique (map accountUserName (attrNames self.nixosModules.accounts))); 342 forAllUsers = genAttrs (unique (map accountUserName (attrNames self.nixosModules.accounts)));
286 343
287 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)); 344 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));
288 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; })); 345 # 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; }));
289 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)))); 346 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))));
290 installerShells = system: pkgs: mapAttrs (installerName: config: pkgs.callPackage ./installer/shell.nix { 347 installerShells = system: pkgs: mapAttrs (installerName: config: pkgs.callPackage ./installer/shell.nix {
291 inherit system installerName config; 348 inherit system installerName config;
@@ -322,18 +379,23 @@
322 nixosConfigurations = installerNixosConfigurations // nixImport rec { dir = ./hosts; _import = mkNixosConfiguration [] dir; }; 379 nixosConfigurations = installerNixosConfigurations // nixImport rec { dir = ./hosts; _import = mkNixosConfiguration [] dir; };
323 380
324 homeModules = nixImport rec { dir = ./home-modules; }; 381 homeModules = nixImport rec { dir = ./home-modules; };
325 homeConfigurations = listToAttrs (concatLists (mapAttrsToList (hostname: nixosConfig: mapAttrsToList (username: configuration: nameValuePair "${username}@${hostname}" { inherit (configuration.home) activationPackage; }) nixosConfig.config.home-manager.users) self.nixosConfigurations)); 382 homeConfigurations = listToAttrs (concatLists (mapAttrsToList (hostname: nixosConfig: mapAttrsToList (username: nameValuePair "${username}@${hostname}") nixosConfig.config.home-manager.users) self.nixosConfigurations));
326 383
327 overlays = mapAttrs (_name: path: mkOverlay path) overlayPaths; 384 overlays = mapAttrs (_name: path: mkOverlay path) overlayPaths;
328 385
329 packages = forAllSystems (system: systemPkgs: nixImport rec { dir = ./tools; _import = _path: name: import "${toString dir}/${name}" ({ inherit system; } // inputs); }); 386 packages = forAllSystems (system: systemPkgs: nixImport rec { dir = ./tools; _import = name: _base: import (dir + "/${name}") ({ inherit system; } // inputs); });
330 387
331 # packages = mapAttrs (_name: filterAttrs (_name: isDerivation)) packages; 388 # packages = mapAttrs (_name: filterAttrs (_name: isDerivation)) packages;
332 # packages' = mapAttrs (_name: filterAttrs (_name: value: !(isDerivation value))) packages; 389 # packages' = mapAttrs (_name: filterAttrs (_name: value: !(isDerivation value))) packages;
333 390
334 legacyPackages = forAllSystems (system: systemPkgs: systemPkgs.override { overlays = attrValues self.overlays; }); 391 legacyPackages = forAllSystems (system: systemPkgs: systemPkgs.override { overlays = attrValues self.overlays; });
335 392
336 apps = foldr recursiveUpdate {} [startVMs activateNixosConfigurations activateHomeManagerConfigurations]; 393 apps = foldr recursiveUpdate {} [
394 #startVMs
395 activateNixosConfigurations activateHomeManagerConfigurations
396 ];
397
398 lib = nixImport rec { dir = ./lib; _import = name: _base: import (dir + "/${name}") inputs; };
337 399
338 devShells = forAllSystems (system: systemPkgs: { default = import ./shell.nix ({ inherit system; } // inputs); } // installerShells system systemPkgs); 400 devShells = forAllSystems (system: systemPkgs: { default = import ./shell.nix ({ inherit system; } // inputs); } // installerShells system systemPkgs);
339 401
@@ -358,10 +420,10 @@
358 # path = activateHomeManager (self.nixosConfigurations.${hostname}.config.nixpkgs.system) usercfg.home; 420 # path = activateHomeManager (self.nixosConfigurations.${hostname}.config.nixpkgs.system) usercfg.home;
359 # }) self.nixosConfigurations.${hostname}.config.home-manager.users); 421 # }) self.nixosConfigurations.${hostname}.config.home-manager.users);
360 }) (nixImport { dir = ./hosts; _import = (_path: name: name); }); 422 }) (nixImport { dir = ./hosts; _import = (_path: name: name); });
361 overrides = if pathExists ./deploy then nixImport { dir = ./deploy; _import = path: _name: import (./deploy + "/${path}") inputs; } else {}; 423 overrides = if pathExists ./deploy then nixImport rec { dir = ./deploy; _import = path: _name: import (dir + "/${path}") inputs; } else {};
362 filterEnabled = attrs: mapAttrs (_n: v: filterAttrs (n: _v: n != "enabled") v) (filterAttrs (_n: v: v.enabled or true) attrs); 424 filterEnabled = attrs: mapAttrs (_n: v: filterAttrs (n: _v: n != "enabled") v) (filterAttrs (_n: v: v.enabled or true) attrs);
363 in mapAttrs (_n: v: if v ? "profiles" then v // { profiles = filterEnabled v.profiles; } else v) (filterEnabled (recursiveUpdate defaults overrides)); 425 in mapAttrs (_n: v: if v ? "profiles" then v // { profiles = filterEnabled v.profiles; } else v) (filterEnabled (recursiveUpdate defaults overrides));
364 426
365 checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib; 427 # checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib;
366 }; 428 };
367} 429}