flake: move hostRegistry to lib
This commit is contained in:
parent
1bf9c651f5
commit
0a6bf04fd2
21
flake.nix
21
flake.nix
|
@ -223,27 +223,8 @@
|
||||||
let
|
let
|
||||||
inherit (nixos) lib;
|
inherit (nixos) lib;
|
||||||
|
|
||||||
extractZwHosts = { hosts4, hosts6, ... }:
|
inherit (import ./lib/network.nix { inherit lib zentralwerk; }) hostRegistry;
|
||||||
lib.recursiveUpdate (
|
|
||||||
builtins.foldl' (result: name:
|
|
||||||
lib.recursiveUpdate result {
|
|
||||||
"${name}".ip4 = hosts4."${name}";
|
|
||||||
}
|
|
||||||
) {} (builtins.attrNames hosts4)
|
|
||||||
) (
|
|
||||||
builtins.foldl' (result: ctx:
|
|
||||||
builtins.foldl' (result: name:
|
|
||||||
lib.recursiveUpdate result {
|
|
||||||
"${name}".ip6 = hosts6."${ctx}"."${name}";
|
|
||||||
}
|
|
||||||
) result (builtins.attrNames hosts6."${ctx}")
|
|
||||||
) {} (builtins.attrNames hosts6)
|
|
||||||
);
|
|
||||||
|
|
||||||
hostRegistry =
|
|
||||||
builtins.foldl' (result: net:
|
|
||||||
lib.recursiveUpdate result (extractZwHosts zentralwerk.lib.config.site.net."${net}")
|
|
||||||
) {} [ "core" "cluster" "c3d2" "serv" "flpk" "pub" ];
|
|
||||||
|
|
||||||
overlayList = [
|
overlayList = [
|
||||||
self.overlays
|
self.overlays
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
{ lib, zentralwerk }:
|
||||||
|
|
||||||
|
rec {
|
||||||
|
extractZwHosts = { hosts4, hosts6, ... }:
|
||||||
|
lib.recursiveUpdate (
|
||||||
|
builtins.foldl' (result: name:
|
||||||
|
lib.recursiveUpdate result {
|
||||||
|
"${name}".ip4 = hosts4."${name}";
|
||||||
|
}
|
||||||
|
) {} (builtins.attrNames hosts4)
|
||||||
|
) (
|
||||||
|
builtins.foldl' (result: ctx:
|
||||||
|
builtins.foldl' (result: name:
|
||||||
|
lib.recursiveUpdate result {
|
||||||
|
"${name}".ip6 = hosts6."${ctx}"."${name}";
|
||||||
|
}
|
||||||
|
) result (builtins.attrNames hosts6."${ctx}")
|
||||||
|
) {} (builtins.attrNames hosts6)
|
||||||
|
);
|
||||||
|
|
||||||
|
hostRegistry =
|
||||||
|
builtins.foldl' (result: net:
|
||||||
|
lib.recursiveUpdate result (extractZwHosts zentralwerk.lib.config.site.net."${net}")
|
||||||
|
) {} [ "core" "cluster" "c3d2" "serv" "flpk" "pub" ];
|
||||||
|
}
|
Loading…
Reference in New Issue