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 | |
| parent | 94dc521310b34b80158d1a0ab65d4daa3a44d81e (diff) | |
systems: nixinate -> deploy-rs (again)
this is for rollbacks during the deploy workflow
Diffstat (limited to 'systems')
| -rw-r--r-- | systems/atlas/default.nix | 8 | ||||
| -rw-r--r-- | systems/default.nix | 8 | ||||
| -rw-r--r-- | systems/deploy.nix | 43 |
3 files changed, 47 insertions, 12 deletions
diff --git a/systems/atlas/default.nix b/systems/atlas/default.nix index d241658..e8c28e3 100644 --- a/systems/atlas/default.nix +++ b/systems/atlas/default.nix @@ -9,14 +9,6 @@ ./nginx.nix ]; - _module.args.nixinate = { - host = "atlas"; - sshUser = "root"; - buildOn = "remote"; - substituteOnTarget = true; - hermetic = false; - }; - age.secrets.teawiebot.file = ../../secrets/systems/atlas/teawieBot.age; boot = { diff --git a/systems/default.nix b/systems/default.nix index 023dc59..5c6703e 100644 --- a/systems/default.nix +++ b/systems/default.nix @@ -24,6 +24,10 @@ mapNixOS = mapSystems inputs.nixpkgs.lib.nixosSystem; inherit (import ./common.nix {inherit inputs self;}) darwin nixos server; in { + imports = [ + ./deploy.nix + ]; + flake = { darwinConfigurations = mapDarwin { caroline = { @@ -72,8 +76,4 @@ in { inherit (inputs) openwrt-imagebuilder; }); }; - - perSystem = {system, ...}: { - apps = (inputs.nixinate.nixinate.${system} self).nixinate; - }; } 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) + ]; + }; +} |
