From 6c2f9aa79f8da2b3a361bb1cd4ffc0e8616c6851 Mon Sep 17 00:00:00 2001 From: truxnell <19149206+truxnell@users.noreply.github.com> Date: Thu, 21 Mar 2024 09:16:30 +1100 Subject: [PATCH] feat: add deploy-rs --- flake.nix | 44 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 37 insertions(+), 7 deletions(-) diff --git a/flake.nix b/flake.nix index 6ee9cc6..2999ee7 100644 --- a/flake.nix +++ b/flake.nix @@ -77,13 +77,13 @@ ]; }; - dns02 = nixpkgs.lib.nixosSystem { - inherit specialArgs; - system = "aarch64-linux"; - modules = defaultModules ++ [ - ./nixos/hosts/dns02 - ]; - }; + # dns02 = nixpkgs.lib.nixosSystem { + # inherit specialArgs; + # system = "aarch64-linux"; + # modules = defaultModules ++ [ + # ./nixos/hosts/dns02 + # ]; + # }; # isoimage = nixpkgs.lib.nixosSystem { # system = "x86_64-linux"; @@ -105,7 +105,37 @@ ]; }; }; + # simple shortcut to allow for easier referencing of correct + # key for building images + # > nix build .#images.rpi4 images.rpi4 = nixosConfigurations.rpi4.config.system.build.sdImage; + + # deploy-rs + deploy.nodes = + let + mkDeployConfig = hostname: configuration: { + inherit hostname; + profiles.system = + let + inherit (configuration.config.nixpkgs.hostPlatform) system; + in + { + path = deploy-rs.lib."${system}".activate.nixos configuration; + sshUser = "truxnell"; + user = "root"; + sshOpts = [ "-t" ]; + autoRollback = false; + magicRollback = true; + }; + }; + in + { + dns01 = mkDeployConfig "10.8.10.11" self.nixosConfigurations.dns01; + # dns02 = mkDeployConfig "dns02.natallan.com" self.nixosConfigurations.dns02; + }; + + # deploy-rs: This is highly advised, and will prevent many possible mistakes + checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib; }; }