diff --git a/meta/dns.nix b/meta/dns.nix index 2f0c758..41e685a 100644 --- a/meta/dns.nix +++ b/meta/dns.nix @@ -1,7 +1,7 @@ { lib, dns, ... }: let - inherit (lib) mapAttrs' nameValuePair; + inherit (lib) mapAttrs' nameValuePair optional; inherit (lib.extra) fuseAttrs mapSingleFuse; inherit (dns.lib.combinators) mx spf ttl; @@ -217,17 +217,19 @@ in subdomains = mapAttrs' ( host: { site, ... }: - nameValuePair "${host}.${site}" ( - with meta.network.${host}.addresses; - { - A = ipv4; - AAAA = ipv6; - subdomains = { - v4.A = ipv4; - v6.AAAA = ipv6; - }; - } - ) + let + net = meta.network.${host}; + inherit (net.addresses) ipv4 ipv6; + in + nameValuePair "${host}.${site}" { + A = ipv4; + AAAA = ipv6; + subdomains = { + v4.A = ipv4; + v6.AAAA = ipv6; + private.A = optional (net.netbirdIp != null) net.netbirdIp; + }; + } ) meta.nodes; }; };