summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--parts/lib/utils.nix52
1 files changed, 23 insertions, 29 deletions
diff --git a/parts/lib/utils.nix b/parts/lib/utils.nix
index f830b1c..e88d651 100644
--- a/parts/lib/utils.nix
+++ b/parts/lib/utils.nix
@@ -1,36 +1,30 @@
{
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;
- };
- })
- ];
- };
+ 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: 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;
+ 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;
+ });
}