diff options
| author | seth <[email protected]> | 2023-08-12 17:22:05 -0400 |
|---|---|---|
| committer | seth <[email protected]> | 2023-08-12 17:32:33 -0400 |
| commit | c4e555842d79e9abd2a432c4fa9eb6722b214141 (patch) | |
| tree | 1461b1b0c64f1bb9d6b1ebae4c1924fb99bf0bf1 /parts/deploy.nix | |
| parent | a5792c3e9a127e0c2ac1b5de022aa44e51570073 (diff) | |
hosts: nixinate -> deploy-rs
Diffstat (limited to 'parts/deploy.nix')
| -rw-r--r-- | parts/deploy.nix | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/parts/deploy.nix b/parts/deploy.nix new file mode 100644 index 0000000..bebf25c --- /dev/null +++ b/parts/deploy.nix @@ -0,0 +1,49 @@ +{ + self, + inputs, + lib, + withSystem, + ... +}: let + systems = ["atlas" "p-body"]; + + deployedSystems = + lib.filterAttrs + (n: _: builtins.elem n systems) + self.nixosConfigurations; + + deployPkgs = import inputs.nixpkgs rec { + system = "x86_64-linux"; + overlays = [ + inputs.deploy-rs.overlay + (_: prev: { + deploy-rs = { + inherit (withSystem system (p: p.pkgs)) deploy-rs; + inherit (prev.deploy-rs) lib; + }; + }) + ]; + }; + + mkNodes = hosts: let + inherit (builtins) attrNames listToAttrs map; + vals = + map (name: let + system = self.nixosConfigurations.${name}; + in { + inherit name; + value = { + sshUser = "root"; + hostname = system.config.networking.hostName; + profiles.system.path = deployPkgs.deploy-rs.lib.activate.nixos system; + }; + }) + (attrNames hosts); + in + listToAttrs vals; +in { + flake.deploy = { + remoteBuild = true; + nodes = mkNodes deployedSystems; + }; +} |
