diff options
Diffstat (limited to 'flake.nix')
-rw-r--r-- | flake.nix | 50 |
1 files changed, 42 insertions, 8 deletions
@@ -125,6 +125,21 @@ | |||
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"; |
@@ -172,7 +187,7 @@ | |||
172 | type = "github"; | 187 | type = "github"; |
173 | owner = "gkleen"; | 188 | owner = "gkleen"; |
174 | repo = "Waybar"; | 189 | repo = "Waybar"; |
175 | ref = "feat/privacy-ignore"; | 190 | ref = "feat/niri-urgency"; |
176 | inputs = { | 191 | inputs = { |
177 | nixpkgs.follows = "nixpkgs"; | 192 | nixpkgs.follows = "nixpkgs"; |
178 | flake-compat.follows = "flake-compat"; | 193 | flake-compat.follows = "flake-compat"; |
@@ -189,6 +204,19 @@ | |||
189 | owner = "sodiboo"; | 204 | owner = "sodiboo"; |
190 | repo = "niri-flake"; | 205 | repo = "niri-flake"; |
191 | ref = "main"; | 206 | ref = "main"; |
207 | inputs = { | ||
208 | nixpkgs.follows = "nixpkgs"; | ||
209 | # niri-unstable.url = "github:gkleen/niri"; | ||
210 | }; | ||
211 | }; | ||
212 | nix-monitored = { | ||
213 | type = "github"; | ||
214 | owner = "ners"; | ||
215 | repo = "nix-monitored"; | ||
216 | ref = "master"; | ||
217 | inputs = { | ||
218 | nixpkgs.follows = "nixpkgs"; | ||
219 | }; | ||
192 | }; | 220 | }; |
193 | }; | 221 | }; |
194 | 222 | ||
@@ -275,9 +303,10 @@ | |||
275 | mkAccountModule = dir: path: accountName: | 303 | mkAccountModule = dir: path: accountName: |
276 | let | 304 | let |
277 | userName = accountUserName accountName; | 305 | userName = accountUserName accountName; |
306 | hostName = accountHostName accountName; | ||
278 | in overrideModule | 307 | in overrideModule |
279 | (import (dir + "/${path}")) | 308 | (import (dir + "/${path}")) |
280 | (inputs: inputs // { inherit userName; }) | 309 | (inputs: inputs // { inherit userName hostName; }) |
281 | (outputs: { _file = dir + "/${path}"; } | 310 | (outputs: { _file = dir + "/${path}"; } |
282 | // outputs | 311 | // outputs |
283 | // { imports = [self.nixosModules.users.${userName} or ({...}: { imports = defaultUserProfiles userName; })] ++ (outputs.imports or []); }); | 312 | // { imports = [self.nixosModules.users.${userName} or ({...}: { imports = defaultUserProfiles userName; })] ++ (outputs.imports or []); }); |
@@ -293,7 +322,7 @@ | |||
293 | forAllUsers = genAttrs (unique (map accountUserName (attrNames self.nixosModules.accounts))); | 322 | forAllUsers = genAttrs (unique (map accountUserName (attrNames self.nixosModules.accounts))); |
294 | 323 | ||
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)); | 324 | 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; })); | 325 | # 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)))); | 326 | 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 { | 327 | installerShells = system: pkgs: mapAttrs (installerName: config: pkgs.callPackage ./installer/shell.nix { |
299 | inherit system installerName config; | 328 | inherit system installerName config; |
@@ -330,18 +359,23 @@ | |||
330 | nixosConfigurations = installerNixosConfigurations // nixImport rec { dir = ./hosts; _import = mkNixosConfiguration [] dir; }; | 359 | nixosConfigurations = installerNixosConfigurations // nixImport rec { dir = ./hosts; _import = mkNixosConfiguration [] dir; }; |
331 | 360 | ||
332 | homeModules = nixImport rec { dir = ./home-modules; }; | 361 | 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)); | 362 | homeConfigurations = listToAttrs (concatLists (mapAttrsToList (hostname: nixosConfig: mapAttrsToList (username: nameValuePair "${username}@${hostname}") nixosConfig.config.home-manager.users) self.nixosConfigurations)); |
334 | 363 | ||
335 | overlays = mapAttrs (_name: path: mkOverlay path) overlayPaths; | 364 | overlays = mapAttrs (_name: path: mkOverlay path) overlayPaths; |
336 | 365 | ||
337 | packages = forAllSystems (system: systemPkgs: nixImport rec { dir = ./tools; _import = _path: name: import "${toString dir}/${name}" ({ inherit system; } // inputs); }); | 366 | packages = forAllSystems (system: systemPkgs: nixImport rec { dir = ./tools; _import = name: _base: import (dir + "/${name}") ({ inherit system; } // inputs); }); |
338 | 367 | ||
339 | # packages = mapAttrs (_name: filterAttrs (_name: isDerivation)) packages; | 368 | # packages = mapAttrs (_name: filterAttrs (_name: isDerivation)) packages; |
340 | # packages' = mapAttrs (_name: filterAttrs (_name: value: !(isDerivation value))) packages; | 369 | # packages' = mapAttrs (_name: filterAttrs (_name: value: !(isDerivation value))) packages; |
341 | 370 | ||
342 | legacyPackages = forAllSystems (system: systemPkgs: systemPkgs.override { overlays = attrValues self.overlays; }); | 371 | legacyPackages = forAllSystems (system: systemPkgs: systemPkgs.override { overlays = attrValues self.overlays; }); |
343 | 372 | ||
344 | apps = foldr recursiveUpdate {} [startVMs activateNixosConfigurations activateHomeManagerConfigurations]; | 373 | apps = foldr recursiveUpdate {} [ |
374 | #startVMs | ||
375 | activateNixosConfigurations activateHomeManagerConfigurations | ||
376 | ]; | ||
377 | |||
378 | lib = nixImport rec { dir = ./lib; _import = name: _base: import (dir + "/${name}") inputs; }; | ||
345 | 379 | ||
346 | devShells = forAllSystems (system: systemPkgs: { default = import ./shell.nix ({ inherit system; } // inputs); } // installerShells system systemPkgs); | 380 | devShells = forAllSystems (system: systemPkgs: { default = import ./shell.nix ({ inherit system; } // inputs); } // installerShells system systemPkgs); |
347 | 381 | ||
@@ -366,10 +400,10 @@ | |||
366 | # path = activateHomeManager (self.nixosConfigurations.${hostname}.config.nixpkgs.system) usercfg.home; | 400 | # path = activateHomeManager (self.nixosConfigurations.${hostname}.config.nixpkgs.system) usercfg.home; |
367 | # }) self.nixosConfigurations.${hostname}.config.home-manager.users); | 401 | # }) self.nixosConfigurations.${hostname}.config.home-manager.users); |
368 | }) (nixImport { dir = ./hosts; _import = (_path: name: name); }); | 402 | }) (nixImport { dir = ./hosts; _import = (_path: name: name); }); |
369 | overrides = if pathExists ./deploy then nixImport { dir = ./deploy; _import = path: _name: import (./deploy + "/${path}") inputs; } else {}; | 403 | 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); | 404 | 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)); | 405 | in mapAttrs (_n: v: if v ? "profiles" then v // { profiles = filterEnabled v.profiles; } else v) (filterEnabled (recursiveUpdate defaults overrides)); |
372 | 406 | ||
373 | checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib; | 407 | # checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib; |
374 | }; | 408 | }; |
375 | } | 409 | } |