summaryrefslogtreecommitdiff
path: root/flake.nix
diff options
context:
space:
mode:
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix90
1 files changed, 74 insertions, 16 deletions
diff --git a/flake.nix b/flake.nix
index cd50543e..b93a1f2e 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 };
@@ -123,25 +125,43 @@
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 };
126 143
127 ca-util = { 144 ca-util = {
128 type = "gitlab"; 145 type = "gitlab";
129 owner = "gkleen"; 146 owner = "gkleen";
130 repo = "ca"; 147 repo = "ca";
131 ref = "v3.1.3"; 148 ref = "v3.1.5";
132 inputs = { 149 inputs = {
150 pyproject-nix.follows = "pyproject-nix";
151 uv2nix.follows = "uv2nix";
133 nixpkgs.follows = "nixpkgs"; 152 nixpkgs.follows = "nixpkgs";
134 poetry2nix.follows = "poetry2nix";
135 }; 153 };
136 }; 154 };
137 backup-utils = { 155 backup-utils = {
138 type = "gitlab"; 156 type = "gitlab";
139 owner = "gkleen"; 157 owner = "gkleen";
140 repo = "backup-utils"; 158 repo = "backup-utils";
141 ref = "v0.1.6"; 159 ref = "v0.1.7";
142 inputs = { 160 inputs = {
143 nixpkgs.follows = "nixpkgs"; 161 nixpkgs.follows = "nixpkgs";
144 poetry2nix.follows = "poetry2nix"; 162 pyproject-nix.follows = "pyproject-nix";
163 uv2nix.follows = "uv2nix";
164 pyproject-build-systems.follows = "pyproject-build-systems";
145 }; 165 };
146 }; 166 };
147 prometheus-borg-exporter = { 167 prometheus-borg-exporter = {
@@ -170,7 +190,7 @@
170 type = "github"; 190 type = "github";
171 owner = "gkleen"; 191 owner = "gkleen";
172 repo = "Waybar"; 192 repo = "Waybar";
173 ref = "feat/privacy-ignore"; 193 ref = "feat/niri-urgency";
174 inputs = { 194 inputs = {
175 nixpkgs.follows = "nixpkgs"; 195 nixpkgs.follows = "nixpkgs";
176 flake-compat.follows = "flake-compat"; 196 flake-compat.follows = "flake-compat";
@@ -182,9 +202,41 @@
182 repo = "NixVirt"; 202 repo = "NixVirt";
183 inputs.nixpkgs.follows = "nixpkgs"; 203 inputs.nixpkgs.follows = "nixpkgs";
184 }; 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 = {
213 type = "github";
214 owner = "gkleen";
215 repo = "niri";
216 ref = "fix/locked-monitor-control";
217 };
218 };
219 };
220 nix-monitored = {
221 type = "github";
222 owner = "ners";
223 repo = "nix-monitored";
224 ref = "master";
225 inputs = {
226 nixpkgs.follows = "nixpkgs";
227 };
228 };
229 lanzaboote = {
230 type = "github";
231 owner = "nix-community";
232 repo = "lanzaboote";
233 ref = "v0.4.2";
234
235 inputs.nixpkgs.follows = "nixpkgs";
236 };
185 }; 237 };
186 238
187 outputs = { self, nixpkgs, home-manager, sops-nix, deploy-rs, nvfetcher, ... }@inputs: 239 outputs = { self, nixpkgs, home-manager, sops-nix, deploy-rs, nvfetcher, niri-flake, ... }@inputs:
188 let 240 let
189 inherit (builtins) attrNames attrValues elemAt toJSON isNull pathExists; 241 inherit (builtins) attrNames attrValues elemAt toJSON isNull pathExists;
190 inherit (nixpkgs) lib; 242 inherit (nixpkgs) lib;
@@ -267,9 +319,10 @@
267 mkAccountModule = dir: path: accountName: 319 mkAccountModule = dir: path: accountName:
268 let 320 let
269 userName = accountUserName accountName; 321 userName = accountUserName accountName;
322 hostName = accountHostName accountName;
270 in overrideModule 323 in overrideModule
271 (import (dir + "/${path}")) 324 (import (dir + "/${path}"))
272 (inputs: inputs // { inherit userName; }) 325 (inputs: inputs // { inherit userName hostName; })
273 (outputs: { _file = dir + "/${path}"; } 326 (outputs: { _file = dir + "/${path}"; }
274 // outputs 327 // outputs
275 // { imports = [self.nixosModules.users.${userName} or ({...}: { imports = defaultUserProfiles userName; })] ++ (outputs.imports or []); }); 328 // { imports = [self.nixosModules.users.${userName} or ({...}: { imports = defaultUserProfiles userName; })] ++ (outputs.imports or []); });
@@ -285,7 +338,7 @@
285 forAllUsers = genAttrs (unique (map accountUserName (attrNames self.nixosModules.accounts))); 338 forAllUsers = genAttrs (unique (map accountUserName (attrNames self.nixosModules.accounts)));
286 339
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)); 340 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; })); 341 # 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)))); 342 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 { 343 installerShells = system: pkgs: mapAttrs (installerName: config: pkgs.callPackage ./installer/shell.nix {
291 inherit system installerName config; 344 inherit system installerName config;
@@ -322,18 +375,23 @@
322 nixosConfigurations = installerNixosConfigurations // nixImport rec { dir = ./hosts; _import = mkNixosConfiguration [] dir; }; 375 nixosConfigurations = installerNixosConfigurations // nixImport rec { dir = ./hosts; _import = mkNixosConfiguration [] dir; };
323 376
324 homeModules = nixImport rec { dir = ./home-modules; }; 377 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)); 378 homeConfigurations = listToAttrs (concatLists (mapAttrsToList (hostname: nixosConfig: mapAttrsToList (username: nameValuePair "${username}@${hostname}") nixosConfig.config.home-manager.users) self.nixosConfigurations));
326 379
327 overlays = mapAttrs (_name: path: mkOverlay path) overlayPaths; 380 overlays = mapAttrs (_name: path: mkOverlay path) overlayPaths;
328 381
329 packages = forAllSystems (system: systemPkgs: nixImport rec { dir = ./tools; _import = _path: name: import "${toString dir}/${name}" ({ inherit system; } // inputs); }); 382 packages = forAllSystems (system: systemPkgs: nixImport rec { dir = ./tools; _import = name: _base: import (dir + "/${name}") ({ inherit system; } // inputs); });
330 383
331 # packages = mapAttrs (_name: filterAttrs (_name: isDerivation)) packages; 384 # packages = mapAttrs (_name: filterAttrs (_name: isDerivation)) packages;
332 # packages' = mapAttrs (_name: filterAttrs (_name: value: !(isDerivation value))) packages; 385 # packages' = mapAttrs (_name: filterAttrs (_name: value: !(isDerivation value))) packages;
333 386
334 legacyPackages = forAllSystems (system: systemPkgs: systemPkgs.override { overlays = attrValues self.overlays; }); 387 legacyPackages = forAllSystems (system: systemPkgs: systemPkgs.override { overlays = attrValues self.overlays; });
335 388
336 apps = foldr recursiveUpdate {} [startVMs activateNixosConfigurations activateHomeManagerConfigurations]; 389 apps = foldr recursiveUpdate {} [
390 #startVMs
391 activateNixosConfigurations activateHomeManagerConfigurations
392 ];
393
394 lib = nixImport rec { dir = ./lib; _import = name: _base: import (dir + "/${name}") inputs; };
337 395
338 devShells = forAllSystems (system: systemPkgs: { default = import ./shell.nix ({ inherit system; } // inputs); } // installerShells system systemPkgs); 396 devShells = forAllSystems (system: systemPkgs: { default = import ./shell.nix ({ inherit system; } // inputs); } // installerShells system systemPkgs);
339 397
@@ -358,10 +416,10 @@
358 # path = activateHomeManager (self.nixosConfigurations.${hostname}.config.nixpkgs.system) usercfg.home; 416 # path = activateHomeManager (self.nixosConfigurations.${hostname}.config.nixpkgs.system) usercfg.home;
359 # }) self.nixosConfigurations.${hostname}.config.home-manager.users); 417 # }) self.nixosConfigurations.${hostname}.config.home-manager.users);
360 }) (nixImport { dir = ./hosts; _import = (_path: name: name); }); 418 }) (nixImport { dir = ./hosts; _import = (_path: name: name); });
361 overrides = if pathExists ./deploy then nixImport { dir = ./deploy; _import = path: _name: import (./deploy + "/${path}") inputs; } else {}; 419 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); 420 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)); 421 in mapAttrs (_n: v: if v ? "profiles" then v // { profiles = filterEnabled v.profiles; } else v) (filterEnabled (recursiveUpdate defaults overrides));
364 422
365 checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib; 423 # checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib;
366 }; 424 };
367} 425}