summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2022-03-13 13:27:43 +0100
committerGregor Kleen <gkleen@yggdrasil.li>2022-03-13 13:27:43 +0100
commit49375b980197db7b4e0d17327b52d37d6ce33f35 (patch)
treeb853bebf5394017890a3abfe6b51f7e571796b16
parentf406ef2b734e3f1d108c4b0c8e2a919fab0c5936 (diff)
downloadnixos-49375b980197db7b4e0d17327b52d37d6ce33f35.tar
nixos-49375b980197db7b4e0d17327b52d37d6ce33f35.tar.gz
nixos-49375b980197db7b4e0d17327b52d37d6ce33f35.tar.bz2
nixos-49375b980197db7b4e0d17327b52d37d6ce33f35.tar.xz
nixos-49375b980197db7b4e0d17327b52d37d6ce33f35.zip
flake: deploy overrides
-rw-r--r--flake.nix32
1 files changed, 18 insertions, 14 deletions
diff --git a/flake.nix b/flake.nix
index 5e5e6d0d..5a62065d 100644
--- a/flake.nix
+++ b/flake.nix
@@ -174,20 +174,24 @@
174 description = "GKleen's flakey nixos configuration"; 174 description = "GKleen's flakey nixos configuration";
175 }; 175 };
176 176
177 deploy.nodes = mapAttrs (hostname: _: { 177 deploy.nodes = let
178 inherit hostname; 178 defaults = mapAttrs (hostname: _: {
179 sshUser = "root"; 179 inherit hostname;
180 180 sshUser = "root";
181 profilesOrder = ["system"]; # system first 181
182 profiles = { 182 profilesOrder = ["system"]; # system first
183 system = { 183 profiles = {
184 path = deploy-rs.lib.${self.nixosConfigurations.${hostname}.config.nixpkgs.system}.activate.nixos self.nixosConfigurations.${hostname}; 184 system = {
185 }; 185 path = deploy-rs.lib.${self.nixosConfigurations.${hostname}.config.nixpkgs.system}.activate.nixos self.nixosConfigurations.${hostname};
186 } // (mapAttrs (_user: usercfg: { 186 };
187 user = usercfg.home.username; 187 } // (mapAttrs (_user: usercfg: {
188 path = activateHomeManager (self.nixosConfigurations.${hostname}.config.nixpkgs.system) usercfg.home; 188 user = usercfg.home.username;
189 }) self.nixosConfigurations.${hostname}.config.home-manager.users); 189 path = activateHomeManager (self.nixosConfigurations.${hostname}.config.nixpkgs.system) usercfg.home;
190 }) (nixImport { dir = ./hosts; _import = (_path: name: name); }); 190 }) self.nixosConfigurations.${hostname}.config.home-manager.users);
191 }) (nixImport { dir = ./hosts; _import = (_path: name: name); });
192 overrides = if pathExists ./deploy then nixImport { dir = ./deploy; _import = path: _name: import (./deploy + "/${path}") inputs; } else {};
193 filterEnabled = attrs: mapAttrs (_n: v: filterAttrs (n: _v: n != "enabled") v) (filterAttrs (_n: v: v.enabled or true) attrs);
194 in mapAttrs (_n: v: if v ? "profiles" then v // { profiles = filterEnabled v.profiles; } else v) (filterEnabled (recursiveUpdate defaults overrides));
191 195
192 checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib; 196 checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib;
193 }; 197 };