summaryrefslogtreecommitdiff
path: root/systems/deploy.nix
diff options
context:
space:
mode:
authorseth <[email protected]>2023-12-13 15:39:09 -0500
committerseth <[email protected]>2023-12-13 15:42:21 -0500
commitfaa11c9d45949922555bf82dda77804828193fa3 (patch)
tree4e21f4d6800e3c2a451a047cdd4365d937cef32c /systems/deploy.nix
parent109114703b42ba17c8f2a4a347bd4a9ecd1e82d5 (diff)
systems: nixinate -> deploy-rs (again (again))
nixinate just hangs as of 163daad93da692fc280036b80f29ca9b65c005d4
Diffstat (limited to 'systems/deploy.nix')
-rw-r--r--systems/deploy.nix43
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)
+ ];
+ };
+}