summaryrefslogtreecommitdiff
path: root/parts/lib/utils/deploy.nix
blob: 261af32f28519c6ce6c965401b3dfdffedebdc8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
{inputs, ...}: let
  inherit (builtins) mapAttrs;
  inherit (inputs) deploy;
in {
  mkDeployNodes = mapAttrs (_: system: let
    inherit (system) pkgs;
    deployPkgs = import pkgs.path {
      inherit (pkgs) system;
      overlays = [
        deploy.overlay
        (_: prev: {
          deploy-rs = {
            inherit (pkgs) deploy-rs;
            inherit (prev.deploy-rs) lib;
          };
        })
      ];
    };

    type =
      if pkgs.stdenv.isLinux
      then "nixos"
      else "darwin";
  in {
    sshUser = "root";
    hostname = system.config.networking.hostName;
    profiles.system.path = deployPkgs.deploy-rs.lib.activate.${type} system;
  });
}