lib/dns: exclude ipv6 ctx yggdrasil

This commit is contained in:
Astro 2022-01-25 01:07:17 +01:00
parent 766a2db2d2
commit b393efecf7
1 changed files with 16 additions and 13 deletions

View File

@ -123,19 +123,22 @@ rec {
# `{ dn42 = { "...ip6.arpa" = "lo.core.zentralwerk.dn42"; }; }`
reverseHosts6 = builtins.foldl' (result: net: lib.recursiveUpdate result (
builtins.mapAttrs (ctx: hosts:
builtins.foldl' (result: host:
let
domain =
if ctx == "dn42"
then namedNets.${net}.domainName
else if builtins.match "up.*" ctx != null
then "${net}.zentralwerk.org"
else throw "Invalid IPv6 context: ${ctx}";
in
lib.recursiveUpdate result {
"${ipv6ToReverse hosts.${host}}" = "${host}.${domain}";
}
) {} (builtins.attrNames hosts)
if ctx == "yggdrasil"
then {}
else
builtins.foldl' (result: host:
let
domain =
if ctx == "dn42"
then "${net}.zentralwerk.dn42"
else if builtins.match "up.*" ctx != null
then namedNets.${net}.domainName
else throw "Invalid IPv6 context: ${ctx}";
in
lib.recursiveUpdate result {
"${ipv6ToReverse hosts.${host}}" = "${host}.${domain}";
}
) {} (builtins.attrNames hosts)
) namedNets.${net}.hosts6
)) {} (builtins.attrNames namedNets);