cluster/services/dns: add nameserver records

This commit is contained in:
Max Headroom 2023-12-03 17:29:27 +01:00
parent afb95e1d3b
commit eae6934b92
2 changed files with 27 additions and 0 deletions

View file

@ -8,6 +8,7 @@ in
imports = [
./options.nix
./nodes.nix
./ns-records.nix
];
links = {

View file

@ -0,0 +1,26 @@
{ config, depot, lib, ... }:
let
cfg = config.services.dns;
nsNodes = lib.imap1 (idx: node: {
name = "eu${toString idx}.ns";
value = {
type = "A";
target = [ depot.hours.${node}.interfaces.primary.addrPublic ];
};
}) cfg.nodes.authoritative;
in
{
dns.records = lib.mkMerge [
(lib.listToAttrs nsNodes)
{
NS = {
name = "@";
type = "NS";
target = map (ns: "${ns.name}.${depot.lib.meta.domain}.") nsNodes;
};
}
];
}