mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-03-22 17:49:07 +01:00
flake-parts/hosts: Refactor
This commit is contained in:
parent
ae5e7e8040
commit
29117dcbb6
1 changed files with 3 additions and 10 deletions
|
|
@ -13,21 +13,14 @@ let
|
|||
(lib.singleton {
|
||||
networking.hostName = hostDir |> lib.baseNameOf |> lib.unsafeDiscardStringContext;
|
||||
})
|
||||
++ (
|
||||
hostDir
|
||||
|> builtins.readDir
|
||||
|> lib.attrNames
|
||||
|> lib.filter (lib.hasSuffix ".nix")
|
||||
|> lib.map (file: "${hostDir}/${file}")
|
||||
);
|
||||
++ self.lib.listNixFilesRecursively hostDir;
|
||||
};
|
||||
|
||||
mkHosts =
|
||||
baseDir:
|
||||
baseDir
|
||||
|> builtins.readDir
|
||||
|> lib.filterAttrs (_: type: type == "directory")
|
||||
|> lib.mapAttrs (hostName: _: mkHost "${baseDir}/${hostName}");
|
||||
|> self.lib.listDirectoryNames
|
||||
|> self.lib.genAttrs (hostName: mkHost "${baseDir}/${hostName}");
|
||||
in
|
||||
{
|
||||
flake = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue