summaryrefslogtreecommitdiff
path: root/parts/lib/utils.nix
blob: e88d65147883bd712b16e35279f0877a836de955 (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
30
{
  self,
  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 = hosts:
    inputs.nixpkgs.lib.genAttrs hosts (host: let
      system = self.nixosConfigurations.${host};
      inherit (system) pkgs;
      inherit (deployPkgs pkgs) deploy-rs;
    in {
      sshUser = "root";
      hostname = system.config.networking.hostName;
      profiles.system.path = deploy-rs.lib.activate.nixos system;
    });
}