diff options
| author | seth <[email protected]> | 2023-12-13 21:26:16 -0500 |
|---|---|---|
| committer | seth <[email protected]> | 2023-12-13 21:26:16 -0500 |
| commit | 63cdf8038777acb98e404a714b9d5108f84226dd (patch) | |
| tree | b42569f101bab704a96cc0725993b9dc16b1a1d1 | |
| parent | 7282595c4d825e330b60b84490af80c8a9a8c657 (diff) | |
systems: refactor deploy
| -rw-r--r-- | systems/deploy.nix | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/systems/deploy.nix b/systems/deploy.nix index 186ff37..fbf20d3 100644 --- a/systems/deploy.nix +++ b/systems/deploy.nix @@ -5,39 +5,40 @@ ... }: let targets = ["atlas"]; + configurations = self.nixosConfigurations // self.darwinConfigurations; getDeploy = pkgs: - (import pkgs.path { - inherit (pkgs) system; - overlays = [ - inputs.deploy.overlay - (_: prev: { - deploy-rs = { - inherit (pkgs) deploy-rs; - inherit (prev.deploy-rs) lib; - }; - }) - ]; - }) + (pkgs.appendOverlays [ + inputs.deploy.overlay + (_: prev: { + deploy-rs = { + inherit (pkgs) deploy-rs; + inherit (prev.deploy-rs) lib; + }; + }) + ]) .deploy-rs; - getType = pkgs: - if pkgs.stdenv.isDarwin - then "darwin" - else "nixos"; + toType = system: + { + "Linux" = "nixos"; + "Darwin" = "darwin"; + } + .${system}; toDeployNode = hostname: system: { sshUser = "root"; inherit hostname; - profiles.system.path = (getDeploy system.pkgs).lib.activate.${getType system.pkgs} system; + profiles.system.path = let + deploy = getDeploy system.pkgs; + type = toType system.pkgs.stdenv.hostPlatform.uname.system; + in + deploy.lib.activate.${type} system; }; in { flake.deploy = { remoteBuild = true; fastConnection = false; - nodes = lib.pipe (self.nixosConfigurations // self.darwinConfigurations) [ - (lib.getAttrs targets) - (lib.mapAttrs toDeployNode) - ]; + nodes = lib.mapAttrs toDeployNode (lib.getAttrs targets configurations); }; } |
