diff options
| author | seth <[email protected]> | 2023-11-14 19:38:13 -0500 |
|---|---|---|
| committer | seth <[email protected]> | 2023-11-14 19:38:13 -0500 |
| commit | f281097023293a482498412d3760f350663b7314 (patch) | |
| tree | 6f89ba89e92645e81acfa73223af044f38b06e1a /systems/deploy.nix | |
| parent | 94dc521310b34b80158d1a0ab65d4daa3a44d81e (diff) | |
systems: nixinate -> deploy-rs (again)
this is for rollbacks during the deploy workflow
Diffstat (limited to 'systems/deploy.nix')
| -rw-r--r-- | systems/deploy.nix | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/systems/deploy.nix b/systems/deploy.nix new file mode 100644 index 0000000..186ff37 --- /dev/null +++ b/systems/deploy.nix @@ -0,0 +1,43 @@ +{ + lib, + inputs, + self, + ... +}: let + targets = ["atlas"]; + + getDeploy = pkgs: + (import pkgs.path { + inherit (pkgs) system; + overlays = [ + 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"; + + toDeployNode = hostname: system: { + sshUser = "root"; + inherit hostname; + profiles.system.path = (getDeploy system.pkgs).lib.activate.${getType system.pkgs} system; + }; +in { + flake.deploy = { + remoteBuild = true; + fastConnection = false; + nodes = lib.pipe (self.nixosConfigurations // self.darwinConfigurations) [ + (lib.getAttrs targets) + (lib.mapAttrs toDeployNode) + ]; + }; +} |
