45 lines
1.1 KiB
Nix
45 lines
1.1 KiB
Nix
{ dns, lib, ... }:
|
|
|
|
with dns.lib.combinators;
|
|
let
|
|
pvvv4Prefix = "129.241.210.";
|
|
domainSuffix = ".pvv.ntnu.no.";
|
|
|
|
pvvHostRecords = import ../pvv-host-forwards.nix { inherit dns lib; };
|
|
|
|
# Find all the A-records pointing into the PVV subnet, and generate the opposing PTR records
|
|
# TODO: Handle duplicates? Avoid NVG-IPs?
|
|
pvvHostReverseRecords = builtins.listToAttrs (
|
|
lib.concatLists (
|
|
lib.mapAttrsToList (
|
|
target: host:
|
|
lib.map (aRecordKey: {
|
|
name = lib.removePrefix pvvv4Prefix aRecordKey;
|
|
value.PTR = [ (target + domainSuffix) ];
|
|
}) (lib.filter (e: lib.hasPrefix pvvv4Prefix e) (host.A or [ ]))
|
|
) pvvHostRecords
|
|
)
|
|
);
|
|
|
|
additionalReverseRecords = {
|
|
"129".PTR = [ "el-swd.nettel.ntnu.no." ]; # Gateway router/switch
|
|
};
|
|
in
|
|
{
|
|
useOrigin = true; # Don't output fully qualified names
|
|
|
|
TTL = 60 * 60;
|
|
|
|
SOA = {
|
|
nameServer = "dvask.pvv.ntnu.no.";
|
|
adminEmail = "drift@pvv.ntnu.no";
|
|
serial = 1970010101; # Placeholder, replaced in deploy step
|
|
};
|
|
NS = [
|
|
"dvask.pvv.ntnu.no."
|
|
"nn.uninett.no."
|
|
];
|
|
|
|
subdomains = pvvHostReverseRecords // additionalReverseRecords;
|
|
}
|