summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2024-08-22 23:16:19 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2024-08-22 23:16:19 +0200
commitc6d39b2d83cf588e1198ac3a2ae1893e276271f9 (patch)
treea3bf0d2a2dd02faf9d51ccd4c32b5ab1b35174ff
parent567c22812fe1fbe525f1732661d253b3902710a9 (diff)
downloadnixos-c6d39b2d83cf588e1198ac3a2ae1893e276271f9.tar
nixos-c6d39b2d83cf588e1198ac3a2ae1893e276271f9.tar.gz
nixos-c6d39b2d83cf588e1198ac3a2ae1893e276271f9.tar.bz2
nixos-c6d39b2d83cf588e1198ac3a2ae1893e276271f9.tar.xz
nixos-c6d39b2d83cf588e1198ac3a2ae1893e276271f9.zip
...
-rw-r--r--accounts/gkleen@sif/hyprland.nix1
-rw-r--r--flake.nix5
-rw-r--r--hosts/surtr/default.nix2
-rw-r--r--installer/default.nix1
-rw-r--r--system-profiles/core/default.nix34
5 files changed, 33 insertions, 10 deletions
diff --git a/accounts/gkleen@sif/hyprland.nix b/accounts/gkleen@sif/hyprland.nix
index 3b2f8879..645a2f22 100644
--- a/accounts/gkleen@sif/hyprland.nix
+++ b/accounts/gkleen@sif/hyprland.nix
@@ -300,6 +300,7 @@ in {
300 "workspace 1, class:^Element$" 300 "workspace 1, class:^Element$"
301 "workspace 1, class:^thunderbird$" 301 "workspace 1, class:^thunderbird$"
302 "workspace 5, class:^virt-manager$" 302 "workspace 5, class:^virt-manager$"
303 "workspace 5, class:^qemu$"
303 "float, class:^org\.keepassxc\.KeePassXC$, title:Access Request$" 304 "float, class:^org\.keepassxc\.KeePassXC$, title:Access Request$"
304 "center, class:^org\.keepassxc\.KeePassXC$, title:Access Request$" 305 "center, class:^org\.keepassxc\.KeePassXC$, title:Access Request$"
305 "float, class:^org\.keepassxc\.KeePassXC$, title:^Unlock Database" 306 "float, class:^org\.keepassxc\.KeePassXC$, title:^Unlock Database"
diff --git a/flake.nix b/flake.nix
index a5bcc93c..728a6322 100644
--- a/flake.nix
+++ b/flake.nix
@@ -286,6 +286,7 @@
286 forAllUsers = genAttrs (unique (map accountUserName (attrNames self.nixosModules.accounts))); 286 forAllUsers = genAttrs (unique (map accountUserName (attrNames self.nixosModules.accounts)));
287 287
288 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 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));
289 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)))); 290 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 { 291 installerShells = system: pkgs: mapAttrs (installerName: config: pkgs.callPackage ./installer/shell.nix {
291 inherit system installerName config; 292 inherit system installerName config;
@@ -302,7 +303,7 @@
302 mkInstallerForSystem = system: (lib.systems.elaborate system).isLinux; 303 mkInstallerForSystem = system: (lib.systems.elaborate system).isLinux;
303 installers = 304 installers =
304 let mkInstallers = system: mapAttrs (mkInstaller system) installerProfiles; 305 let mkInstallers = system: mapAttrs (mkInstaller system) installerProfiles;
305 mkInstaller = system: name: profile: mkNixosConfiguration [profile { config = { nixpkgs.system = system; }; }] ./. installerConfig "installer"; 306 mkInstaller = system: name: profile: mkNixosConfiguration [profile { config.nixpkgs.system = system; }] ./. installerConfig "installer";
306 in forAllSystems (system: _systemPkgs: optionalAttrs (!(isNull installerConfig) && mkInstallerForSystem system) (mkInstallers system)); 307 in forAllSystems (system: _systemPkgs: optionalAttrs (!(isNull installerConfig) && mkInstallerForSystem system) (mkInstallers system));
307 installerNixosConfigurations = listToAttrs (concatLists (mapAttrsToList (system: mapAttrsToList (profile: config: nameValuePair ("installer-${system}-${profile}") config)) installers)); 308 installerNixosConfigurations = listToAttrs (concatLists (mapAttrsToList (system: mapAttrsToList (profile: config: nameValuePair ("installer-${system}-${profile}") config)) installers));
308 309
@@ -333,7 +334,7 @@
333 334
334 legacyPackages = forAllSystems (system: systemPkgs: systemPkgs.override { overlays = attrValues self.overlays; }); 335 legacyPackages = forAllSystems (system: systemPkgs: systemPkgs.override { overlays = attrValues self.overlays; });
335 336
336 apps = foldr recursiveUpdate {} [activateNixosConfigurations activateHomeManagerConfigurations]; 337 apps = foldr recursiveUpdate {} [startVMs activateNixosConfigurations activateHomeManagerConfigurations];
337 338
338 devShells = forAllSystems (system: systemPkgs: { default = import ./shell.nix ({ inherit system; } // inputs); } // installerShells system systemPkgs); 339 devShells = forAllSystems (system: systemPkgs: { default = import ./shell.nix ({ inherit system; } // inputs); } // installerShells system systemPkgs);
339 340
diff --git a/hosts/surtr/default.nix b/hosts/surtr/default.nix
index ceb035cb..705f69b3 100644
--- a/hosts/surtr/default.nix
+++ b/hosts/surtr/default.nix
@@ -166,6 +166,8 @@ with lib;
166 }; 166 };
167 167
168 systemd.sysusers.enable = false; 168 systemd.sysusers.enable = false;
169 system.etc.overlay.mutable = true;
170 boot.enableContainers = true;
169 system.stateVersion = "20.09"; 171 system.stateVersion = "20.09";
170 }; 172 };
171} 173}
diff --git a/installer/default.nix b/installer/default.nix
index e9d9fa1a..d5e0fc07 100644
--- a/installer/default.nix
+++ b/installer/default.nix
@@ -57,6 +57,7 @@ with lib;
57 57
58 system.disableInstallerTools = false; 58 system.disableInstallerTools = false;
59 59
60 systemd.sysusers.enable = false;
60 system.stateVersion = config.system.nixos.release; # No state in installer 61 system.stateVersion = config.system.nixos.release; # No state in installer
61 }; 62 };
62} 63}
diff --git a/system-profiles/core/default.nix b/system-profiles/core/default.nix
index fede386b..71d0619a 100644
--- a/system-profiles/core/default.nix
+++ b/system-profiles/core/default.nix
@@ -1,4 +1,4 @@
1{ flake, flakeInputs, home-manager, path, hostName, config, lib, pkgs, customUtils, ... }: 1{ flake, flakeInputs, home-manager, path, hostName, config, options, lib, pkgs, customUtils, ... }:
2 2
3with lib; 3with lib;
4 4
@@ -83,11 +83,22 @@ in {
83 ''; 83 '';
84 }; 84 };
85 85
86 nixpkgs.flakeInput = mkOption { 86 nixpkgs = {
87 type = types.enum (attrNames flakeInputs); 87 flakeInput = mkOption {
88 default = if flakeInputs ? "nixpkgs-${hostName}" then "nixpkgs-${hostName}" else "nixpkgs"; 88 type = types.enum (attrNames flakeInputs);
89 defaultText = literalExpression ''if flakeInputs ? "nixpkgs-''${hostName}" then "nixpkgs-''${hostName}" else "nixpkgs"''; 89 default = if flakeInputs ? "nixpkgs-${hostName}" then "nixpkgs-${hostName}" else "nixpkgs";
90 internal = true; 90 defaultText = literalExpression ''if flakeInputs ? "nixpkgs-''${hostName}" then "nixpkgs-''${hostName}" else "nixpkgs"'';
91 internal = true;
92 };
93 extraOverlays = mkOption {
94 default = [];
95 type = types.listOf (mkOptionType {
96 name = "nixpkgs-overlay";
97 description = "nixpkgs overlay";
98 check = lib.isFunction;
99 merge = lib.mergeOneOption;
100 });
101 };
91 }; 102 };
92 }; 103 };
93 104
@@ -97,7 +108,7 @@ in {
97 system.configurationRevision = mkIf (flake ? rev) flake.rev; 108 system.configurationRevision = mkIf (flake ? rev) flake.rev;
98 109
99 nixpkgs.pkgs = import (flakeInputs.${config.nixpkgs.flakeInput}.outPath + "/pkgs/top-level") { 110 nixpkgs.pkgs = import (flakeInputs.${config.nixpkgs.flakeInput}.outPath + "/pkgs/top-level") {
100 overlays = attrValues flake.overlays; 111 overlays = attrValues flake.overlays ++ config.nixpkgs.extraOverlays;
101 config = config.nixpkgs.externalConfig; 112 config = config.nixpkgs.externalConfig;
102 localSystem = config.nixpkgs.system; 113 localSystem = config.nixpkgs.system;
103 }; 114 };
@@ -131,7 +142,7 @@ in {
131 }; 142 };
132 143
133 systemd.tmpfiles.rules = [ 144 systemd.tmpfiles.rules = [
134 "L+ /run/nixpkgs - - - - ${flakeInputs.nixpkgs.outPath}" 145 "L+ /run/nixpkgs - - - - ${flakeInputs.${config.nixpkgs.flakeInput}.outPath}"
135 "L+ /run/nixpkgs-overlays.nix - - - - ${pkgs.writeText "overlays.nix" '' 146 "L+ /run/nixpkgs-overlays.nix - - - - ${pkgs.writeText "overlays.nix" ''
136 with builtins; 147 with builtins;
137 148
@@ -200,6 +211,7 @@ in {
200 ++ (optional (options ? system.etc) { 211 ++ (optional (options ? system.etc) {
201 boot.initrd.systemd.enable = lib.mkDefault true; 212 boot.initrd.systemd.enable = lib.mkDefault true;
202 system.etc.overlay.enable = lib.mkDefault true; 213 system.etc.overlay.enable = lib.mkDefault true;
214 system.etc.overlay.mutable = lib.mkDefault (!config.systemd.sysusers.enable);
203 systemd.sysusers.enable = lib.mkDefault true; 215 systemd.sysusers.enable = lib.mkDefault true;
204 216
205 # Random perl remnants 217 # Random perl remnants
@@ -210,5 +222,11 @@ in {
210 boot.loader.grub.enable = lib.mkDefault false; 222 boot.loader.grub.enable = lib.mkDefault false;
211 environment.defaultPackages = lib.mkDefault [ ]; 223 environment.defaultPackages = lib.mkDefault [ ];
212 documentation.info.enable = lib.mkDefault false; 224 documentation.info.enable = lib.mkDefault false;
225 })
226 ++ (optional (options ? nixpkgs.flake) {
227 nixpkgs.flake = {
228 setNixPath = false;
229 setFlakeRegistry = false;
230 };
213 })); 231 }));
214} 232}