From 06bbe99769f255460182b15caf301692f46c96ab Mon Sep 17 00:00:00 2001 From: Tom Hubrecht Date: Wed, 30 Oct 2024 10:35:12 +0100 Subject: [PATCH] feat(meta/dns): Add private subdomain linking to the netbird ips --- meta/dns.nix | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) 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; }; };