summaryrefslogtreecommitdiff
path: root/parts/lib/utils.nix
blob: 7e3109fa7d6ab8db0a1df9dc0bcd074006a721fd (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
{inputs, ...}: let
  deployPkgs = pkgs:
    import pkgs.path {
      inherit (pkgs) system;
      overlays = [
        inputs.deploy-rs.overlay
        (_: prev: {
          deploy-rs = {
            inherit (pkgs) deploy-rs;
            inherit (prev.deploy-rs) lib;
          };
        })
      ];
    };
in {
  mkDeployNodes = builtins.mapAttrs (_: system: let
    inherit (deployPkgs system.pkgs) deploy-rs;
    type =
      if system.pkgs.stdenv.isLinux
      then "nixos"
      else "darwin";
  in {
    sshUser = "root";
    hostname = system.config.networking.hostName;
    profiles.system.path = deploy-rs.lib.activate.${type} system;
  });
}