about summary refs log tree commit diff
path: root/flake.nix
diff options
context:
space:
mode:
authorBaitinq <manuelpalenzuelamerino@gmail.com>2022-10-13 16:09:29 +0200
committerBaitinq <manuelpalenzuelamerino@gmail.com>2022-10-13 16:09:29 +0200
commitc08407b571b1c962e0b5e09d82d164b8dc4aef36 (patch)
treeebed1717d7aca579c5968517a9cac633805ac7d6 /flake.nix
parentHosts: Root user: Add authorized ssh keys (diff)
downloadnixos-config-c08407b571b1c962e0b5e09d82d164b8dc4aef36.tar.gz
nixos-config-c08407b571b1c962e0b5e09d82d164b8dc4aef36.tar.bz2
nixos-config-c08407b571b1c962e0b5e09d82d164b8dc4aef36.zip
Misc: Add deploy-rs tool and setup deploy configurations
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix25
1 files changed, 25 insertions, 0 deletions
diff --git a/flake.nix b/flake.nix
index 9d87f10..f3342cd 100644
--- a/flake.nix
+++ b/flake.nix
@@ -13,6 +13,11 @@
 
     impermanence.url = "github:nix-community/impermanence";
 
+    deploy-rs = {
+      url = "github:serokell/deploy-rs";
+      inputs.nixpkgs.follows = "nixpkgs";
+    };
+
     nur.url = "github:nix-community/NUR";
 
     nix-index.url = "github:Mic92/nix-index-database";
@@ -81,5 +86,25 @@
         isIso = false;
         isHardware = false;
       });
+
+
+      deploy = {
+        magicRollback = true;
+        autoRollback = true;
+
+        nodes = builtins.mapAttrs
+          (_: nixosConfig: {
+            hostname = "${nixosConfig.config.networking.hostName}";
+
+            profiles.system = {
+              user = "root";
+              path = inputs.deploy-rs.lib.${nixosConfig.config.nixpkgs.system}.activate.nixos nixosConfig;
+            };
+          })
+          self.nixosConfigurations;
+      };
+
+      # This is highly advised, and will prevent many possible mistakes
+      checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) inputs.deploy-rs.lib;
     };
 }