infrastructure/modules/dgn-dns/zones/default.nix
Tom Hubrecht c2616ce4f5 modules/dgn-dns: init
Also deploy a DNS server on compute01
2023-07-21 00:37:05 +02:00

52 lines
1 KiB
Nix

args@{ dgn-lib, dns, ... }:
let
inherit (dgn-lib)
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