Use the pipe operator when applicable

This commit is contained in:
SebastianStork 2025-04-06 22:14:20 +02:00
parent 61083d4359
commit cd4e3ab2c1
2 changed files with 17 additions and 12 deletions

View file

@ -5,19 +5,24 @@
...
}:
let
mkHost = hostname: {
${hostname} = inputs.nixpkgs.lib.nixosSystem {
mkHost = hostName: {
${hostName} = inputs.nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs self; };
modules =
[
{ networking.hostName = hostname; }
"${self}/hosts/${hostname}"
]
++ builtins.filter (path: builtins.pathExists path) (
map (user: "${self}/users/${user}/@${hostname}") (
builtins.attrNames (lib.filterAttrs (_: v: v == "directory") (builtins.readDir "${self}/users"))
)
);
let
userFiles =
"${self}/users"
|> builtins.readDir
|> lib.filterAttrs (_: type: type == "directory")
|> builtins.attrNames
|> map (user: "${self}/users/${user}/@${hostName}")
|> builtins.filter (path: builtins.pathExists path);
in
lib.flatten [
{ networking = { inherit hostName; }; }
"${self}/hosts/${hostName}"
userFiles
];
};
};
in