diff options
| author | seth <[email protected]> | 2023-08-16 10:45:59 -0400 |
|---|---|---|
| committer | seth <[email protected]> | 2023-08-17 13:55:47 -0400 |
| commit | 54f63fc2ddb0967d4ec020ce3389edec8ce3e161 (patch) | |
| tree | 632e0f54829fb1c622888902024fc5a3e76c2d7b /parts/lib/utils.nix | |
| parent | ce0784d64fd7775bbdf7c0bb0f9b6cb8a4682715 (diff) | |
parts/lib: init
Diffstat (limited to 'parts/lib/utils.nix')
| -rw-r--r-- | parts/lib/utils.nix | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/parts/lib/utils.nix b/parts/lib/utils.nix new file mode 100644 index 0000000..f830b1c --- /dev/null +++ b/parts/lib/utils.nix @@ -0,0 +1,36 @@ +{ + self, + inputs, + withSystem, + ... +}: let + deployPkgs = import inputs.nixpkgs rec { + system = "x86_64-linux"; + overlays = [ + inputs.deploy-rs.overlay + (_: prev: { + deploy-rs = { + inherit (withSystem system (p: p.pkgs)) deploy-rs; + inherit (prev.deploy-rs) lib; + }; + }) + ]; + }; +in { + mkDeployNodes = hosts: let + inherit (builtins) attrNames listToAttrs map; + vals = + map (name: let + system = self.nixosConfigurations.${name}; + in { + inherit name; + value = { + sshUser = "root"; + hostname = system.config.networking.hostName; + profiles.system.path = deployPkgs.deploy-rs.lib.activate.nixos system; + }; + }) + (attrNames hosts); + in + listToAttrs vals; +} |
