nix-config/lib/network.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

26 lines
758 B
Nix
Raw Normal View History

2023-04-11 00:24:56 +02:00
{ 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" ];
}