mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-03-22 22:29:06 +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 {
|
(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 = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue