infrastructure/modules/dgn-dns/zones/default.nix
2023-10-04 09:23:48 +02:00

52 lines
1 KiB
Nix

args@{ lib, dns, ... }:
let
inherit (lib.extra)
mapSingleFuse
mkRel
recursiveFuse;
delegations = {
"dgnum.eu" = {
"ns-01.hubrecht.ovh." = [ "51.15.174.50" ];
"ns-03.hubrecht.ovh." = [ "51.178.27.125" ];
"kurisu.dual.lahfa.xyz." = [ ];
};
};
servedZones = [
"dgnum.eu"
# For reverse DNS
# "ip6.arpa"
];
SOA = {
nameServer = "ns01.dgnum.eu.";
adminEmail = "dns.dgnum.eu";
serial = import ../serial.nix;
retry = 3600;
minimum = 300;
};
mkZone = zone:
let
secondaryDNS = builtins.map
(ip: "${ip} NOKEY")
(builtins.concatLists (builtins.attrValues (delegations.${zone} or { })));
in
{
data =
let attrs = import (mkRel ./. "_${zone}.nix") args; in
dns.lib.toString zone (recursiveFuse [
{ inherit SOA; }
attrs
{ NS = attrs.NS ++ (builtins.attrNames (delegations.${zone} or { })); }
]);
provideXFR = secondaryDNS;
notify = secondaryDNS;
};
in
mapSingleFuse mkZone servedZones