feat: add records from non local machines

This commit is contained in:
Julien Malka 2024-08-14 14:58:06 +02:00
parent 58a3dd5088
commit 04bb06f49d
Signed by: Luj
GPG key ID: 6FC74C847011FD83

View file

@ -12,6 +12,34 @@ let
lib.attrValues nixosConfigurations
)
);
allowedDomains = [
"luj.fr"
"julienmalka.me"
"malka.family"
"luj"
"luj-static.page"
];
isVPNDomain = domain: lib.dns.domainToZone [ "luj" ] domain != null;
zonesFromSnowField = lib.fold (elem: acc: acc // elem) { } (
lib.flatten (
map (
elem:
let
domains = if builtins.hasAttr "subdomains" elem then elem.subdomains else [ ];
in
map (domain: {
machine.meta.zones.${lib.dns.domainToZone allowedDomains domain}.subdomains =
lib.dns.domainToRecords domain elem
(isVPNDomain domain);
}) domains
) (lib.attrValues lib.snowfield)
)
);
dnsLib = (import inputs.dns).lib;
evalZones =
zones:
@ -35,6 +63,7 @@ let
in
lib.mkMerge [
{
services.nsd = {
enable = true;
@ -64,3 +93,7 @@ in
networking.firewall.allowedUDPPorts = [ 53 ];
}
# DNS Records from all non local configurations are exported here
zonesFromSnowField
]