flake-parts/hosts: Refactor

This commit is contained in:
SebastianStork 2026-02-08 22:04:41 +01:00
parent ae5e7e8040
commit 29117dcbb6
Signed by: SebastianStork
SSH key fingerprint: SHA256:tRrGdjYOwgHxpSc/wTOZQZEjxcb15P0tyXRsbAfd+2Q

View file

@ -13,21 +13,14 @@ let
(lib.singleton { (lib.singleton {
networking.hostName = hostDir |> lib.baseNameOf |> lib.unsafeDiscardStringContext; networking.hostName = hostDir |> lib.baseNameOf |> lib.unsafeDiscardStringContext;
}) })
++ ( ++ self.lib.listNixFilesRecursively hostDir;
hostDir
|> builtins.readDir
|> lib.attrNames
|> lib.filter (lib.hasSuffix ".nix")
|> lib.map (file: "${hostDir}/${file}")
);
}; };
mkHosts = mkHosts =
baseDir: baseDir:
baseDir baseDir
|> builtins.readDir |> self.lib.listDirectoryNames
|> lib.filterAttrs (_: type: type == "directory") |> self.lib.genAttrs (hostName: mkHost "${baseDir}/${hostName}");
|> lib.mapAttrs (hostName: _: mkHost "${baseDir}/${hostName}");
in in
{ {
flake = { flake = {