hosts.nix: replace lib.concatMapAttrs with lib.mapAttrs

This commit is contained in:
SebastianStork 2025-07-22 22:26:07 +02:00
parent 5e18975b9b
commit 043a996319

View file

@ -5,8 +5,9 @@
... ...
}: }:
let let
mkHost = hostName: { mkHost =
${hostName} = inputs.nixpkgs.lib.nixosSystem { hostName:
inputs.nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs self; }; specialArgs = { inherit inputs self; };
modules = modules =
let let
@ -21,17 +22,14 @@ let
] ]
++ hostFiles; ++ hostFiles;
}; };
};
mkDeployNode = hostName: { mkDeployNode = hostname: {
${hostName} = { inherit hostname;
hostname = hostName; user = "root";
user = "root"; interactiveSudo = true;
interactiveSudo = true; profiles.system.path =
profiles.system.path = inputs.deploy-rs.lib.x86_64-linux.activate.nixos
inputs.deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.${hostname};
self.nixosConfigurations.${hostName};
};
}; };
in in
{ {
@ -40,13 +38,13 @@ in
"${self}/hosts" "${self}/hosts"
|> builtins.readDir |> builtins.readDir
|> lib.filterAttrs (_: type: type == "directory") |> lib.filterAttrs (_: type: type == "directory")
|> lib.concatMapAttrs (name: _: mkHost name); |> lib.mapAttrs (name: _: mkHost name);
deploy.nodes = deploy.nodes =
"${self}/hosts" "${self}/hosts"
|> builtins.readDir |> builtins.readDir
|> lib.filterAttrs (_: type: type == "directory") |> lib.filterAttrs (_: type: type == "directory")
|> lib.concatMapAttrs (name: _: mkDeployNode name); |> lib.mapAttrs (name: _: mkDeployNode name);
checks = builtins.mapAttrs (_: deployLib: deployLib.deployChecks self.deploy) inputs.deploy-rs.lib; checks = builtins.mapAttrs (_: deployLib: deployLib.deployChecks self.deploy) inputs.deploy-rs.lib;
}; };