summaryrefslogtreecommitdiff
path: root/flake.nix
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2022-04-06 14:05:08 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2022-04-06 14:05:08 +0200
commit8fb207dbb8c944847cc523f844fd05b6e7fe6fae (patch)
treed218689404ca881b4aa840f20ed6ac7563c56b1a /flake.nix
parentac4ee9ac159a2de4602b420ba4d16c5cd7040039 (diff)
downloadnixos-8fb207dbb8c944847cc523f844fd05b6e7fe6fae.tar
nixos-8fb207dbb8c944847cc523f844fd05b6e7fe6fae.tar.gz
nixos-8fb207dbb8c944847cc523f844fd05b6e7fe6fae.tar.bz2
nixos-8fb207dbb8c944847cc523f844fd05b6e7fe6fae.tar.xz
nixos-8fb207dbb8c944847cc523f844fd05b6e7fe6fae.zip
...
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix16
1 files changed, 9 insertions, 7 deletions
diff --git a/flake.nix b/flake.nix
index e5aa1329..163e7bd5 100644
--- a/flake.nix
+++ b/flake.nix
@@ -57,7 +57,7 @@
57 inherit (nixpkgs) lib; 57 inherit (nixpkgs) lib;
58 utils = import ./utils { inherit lib; }; 58 utils = import ./utils { inherit lib; };
59 inherit (utils) nixImport overrideModule; 59 inherit (utils) nixImport overrideModule;
60 inherit (lib) nixosSystem mkIf splitString filterAttrs listToAttrs mapAttrsToList nameValuePair concatMap composeManyExtensions mapAttrs mapAttrs' recursiveUpdate genAttrs unique elem optionalAttrs isDerivation concatLists concatStringsSep; 60 inherit (lib) nixosSystem mkIf splitString filterAttrs listToAttrs mapAttrsToList nameValuePair concatMap composeManyExtensions mapAttrs mapAttrs' recursiveUpdate genAttrs unique elem optionalAttrs isDerivation concatLists concatStringsSep fix filter makeOverridable;
61 inherit (lib.strings) escapeNixString; 61 inherit (lib.strings) escapeNixString;
62 62
63 accountUserName = accountName: 63 accountUserName = accountName:
@@ -139,7 +139,9 @@
139 // { imports = [self.nixosModules.users.${userName} or ({...}: { imports = defaultUserProfiles userName; })] ++ (outputs.imports or []); }); 139 // { imports = [self.nixosModules.users.${userName} or ({...}: { imports = defaultUserProfiles userName; })] ++ (outputs.imports or []); });
140 140
141 systemsSelector = "x86_64-linux"; 141 systemsSelector = "x86_64-linux";
142 forAllSystems = f: mapAttrs f (filterAttrs (system: _systemPkgs: !(isNull (builtins.match systemsSelector system))) nixpkgs.legacyPackages); 142 systems = filter (system: !(isNull (builtins.match systemsSelector system))) nixpkgs.lib.systems.supported.hydra;
143 nixpkgsPackages = localSystem: (makeOverridable (import (nixpkgs.outPath + "/pkgs/top-level"))) { inherit localSystem; };
144 forAllSystems = f: mapAttrs f (genAttrs systems nixpkgsPackages);
143 forAllUsers = genAttrs (unique (map accountUserName (attrNames self.nixosModules.accounts))); 145 forAllUsers = genAttrs (unique (map accountUserName (attrNames self.nixosModules.accounts)));
144 146
145 activateNixosConfigurations = forAllSystems (system: _pkgs: mapAttrs' (hostName: nixosConfig: nameValuePair "${hostName}-activate" { type = "app"; program = "${nixosConfig.config.system.build.toplevel}/bin/switch-to-configuration"; }) self.nixosConfigurations); 147 activateNixosConfigurations = forAllSystems (system: _pkgs: mapAttrs' (hostName: nixosConfig: nameValuePair "${hostName}-activate" { type = "app"; program = "${nixosConfig.config.system.build.toplevel}/bin/switch-to-configuration"; }) self.nixosConfigurations);
@@ -147,7 +149,7 @@
147 overlayPaths = nixImport rec { dir = ./overlays; _import = (path: _name: dir + "/${path}"); }; 149 overlayPaths = nixImport rec { dir = ./overlays; _import = (path: _name: dir + "/${path}"); };
148 150
149 installerProfiles = system: 151 installerProfiles = system:
150 let nixpkgs-path = nixpkgs.legacyPackages.${system}.path; 152 let nixpkgs-path = nixpkgs.outPath;
151 in mapAttrs (name: {path, output}: { profile = mkSystemProfile nixpkgs-path path "installer-${name}"; inherit output; }) 153 in mapAttrs (name: {path, output}: { profile = mkSystemProfile nixpkgs-path path "installer-${name}"; inherit output; })
152 { cd-dvd = { path = "nixos/modules/installer/cd-dvd/installation-cd-minimal.nix"; output = out: out.config.system.build.isoImage; }; 154 { cd-dvd = { path = "nixos/modules/installer/cd-dvd/installation-cd-minimal.nix"; output = out: out.config.system.build.isoImage; };
153 netboot = { path = "nixos/modules/installer/netboot/netboot-minimal.nix"; output = out: (self.legacyPackages.${system}.symlinkJoin { name = "netboot"; paths = with out.config.system.build; [ netbootRamdisk kernel netbootIpxeScript ]; preferLocalBuild = true; }); }; 155 netboot = { path = "nixos/modules/installer/netboot/netboot-minimal.nix"; output = out: (self.legacyPackages.${system}.symlinkJoin { name = "netboot"; paths = with out.config.system.build; [ netbootRamdisk kernel netbootIpxeScript ]; preferLocalBuild = true; }); };
@@ -160,7 +162,7 @@
160 in forAllSystems (system: _systemPkgs: optionalAttrs (!(isNull installerConfig)) (mkInstallers system)); 162 in forAllSystems (system: _systemPkgs: optionalAttrs (!(isNull installerConfig)) (mkInstallers system));
161 installerNixosConfigurations = listToAttrs (concatLists (mapAttrsToList (system: mapAttrsToList (profile: { config, ... }: nameValuePair ("installer-${system}-${profile}") config)) installers)); 163 installerNixosConfigurations = listToAttrs (concatLists (mapAttrsToList (system: mapAttrsToList (profile: { config, ... }: nameValuePair ("installer-${system}-${profile}") config)) installers));
162 164
163 packages = forAllSystems (system: systemPkgs: composeManyExtensions (attrValues self.overlays) self.legacyPackages.${system} systemPkgs); 165 # packages = forAllSystems (system: systemPkgs: composeManyExtensions (attrValues self.overlays) self.legacyPackages.${system} systemPkgs);
164 166
165 activateHomeManager = system: base: (deploy-rs.lib.${system}.activate.custom // { dryActivate = "DRY_RUN=1 $PROFILE/activate"; }) base.activationPackage "$PROFILE/activate"; 167 activateHomeManager = system: base: (deploy-rs.lib.${system}.activate.custom // { dryActivate = "DRY_RUN=1 $PROFILE/activate"; }) base.activationPackage "$PROFILE/activate";
166 in 168 in
@@ -180,10 +182,10 @@
180 182
181 overlays = mapAttrs (_name: path: mkOverlay path) overlayPaths; 183 overlays = mapAttrs (_name: path: mkOverlay path) overlayPaths;
182 184
183 packages = mapAttrs (_name: filterAttrs (_name: isDerivation)) packages; 185 # packages = mapAttrs (_name: filterAttrs (_name: isDerivation)) packages;
184 packages' = mapAttrs (_name: filterAttrs (_name: value: !(isDerivation value))) packages; 186 # packages' = mapAttrs (_name: filterAttrs (_name: value: !(isDerivation value))) packages;
185 187
186 legacyPackages = forAllSystems (system: systemPkgs: recursiveUpdate systemPkgs packages.${system}); 188 legacyPackages = forAllSystems (system: systemPkgs: systemPkgs.override { overlays = attrValues self.overlays; });
187 189
188 apps = activateNixosConfigurations; 190 apps = activateNixosConfigurations;
189 191