summaryrefslogtreecommitdiff
path: root/systems
diff options
context:
space:
mode:
authorseth <[email protected]>2023-12-13 21:26:16 -0500
committerseth <[email protected]>2023-12-13 21:26:16 -0500
commit63cdf8038777acb98e404a714b9d5108f84226dd (patch)
treeb42569f101bab704a96cc0725993b9dc16b1a1d1 /systems
parent7282595c4d825e330b60b84490af80c8a9a8c657 (diff)
systems: refactor deploy
Diffstat (limited to 'systems')
-rw-r--r--systems/deploy.nix43
1 files changed, 22 insertions, 21 deletions
diff --git a/systems/deploy.nix b/systems/deploy.nix
index 186ff37..fbf20d3 100644
--- a/systems/deploy.nix
+++ b/systems/deploy.nix
@@ -5,39 +5,40 @@
...
}: let
targets = ["atlas"];
+ configurations = self.nixosConfigurations // self.darwinConfigurations;
getDeploy = pkgs:
- (import pkgs.path {
- inherit (pkgs) system;
- overlays = [
- inputs.deploy.overlay
- (_: prev: {
- deploy-rs = {
- inherit (pkgs) deploy-rs;
- inherit (prev.deploy-rs) lib;
- };
- })
- ];
- })
+ (pkgs.appendOverlays [
+ 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";
+ toType = system:
+ {
+ "Linux" = "nixos";
+ "Darwin" = "darwin";
+ }
+ .${system};
toDeployNode = hostname: system: {
sshUser = "root";
inherit hostname;
- profiles.system.path = (getDeploy system.pkgs).lib.activate.${getType system.pkgs} system;
+ profiles.system.path = let
+ deploy = getDeploy system.pkgs;
+ type = toType system.pkgs.stdenv.hostPlatform.uname.system;
+ in
+ deploy.lib.activate.${type} system;
};
in {
flake.deploy = {
remoteBuild = true;
fastConnection = false;
- nodes = lib.pipe (self.nixosConfigurations // self.darwinConfigurations) [
- (lib.getAttrs targets)
- (lib.mapAttrs toDeployNode)
- ];
+ nodes = lib.mapAttrs toDeployNode (lib.getAttrs targets configurations);
};
}