2023-03-23 00:00:29 +02:00
|
|
|
{ config, depot, lib, ... }:
|
2022-08-07 20:58:37 +03:00
|
|
|
|
|
|
|
let
|
2023-03-07 02:26:07 +02:00
|
|
|
inherit (depot.config) hours;
|
2023-03-23 00:00:29 +02:00
|
|
|
cfg = config.services.dns;
|
2022-08-07 20:58:37 +03:00
|
|
|
in
|
|
|
|
{
|
2022-08-07 21:59:16 +03:00
|
|
|
vars.pdns-api-key-secret = {
|
|
|
|
file = ./pdns-api-key.age;
|
|
|
|
mode = "0400";
|
|
|
|
};
|
2022-08-07 20:58:37 +03:00
|
|
|
links = {
|
|
|
|
dnsResolver = {
|
2023-03-07 02:26:07 +02:00
|
|
|
ipv4 = hours.VEGAS.interfaces.vstub.addr;
|
2022-08-07 20:58:37 +03:00
|
|
|
port = 53;
|
|
|
|
};
|
|
|
|
powerdns-api = {
|
|
|
|
ipv4 = config.vars.mesh.VEGAS.meshIp;
|
|
|
|
protocol = "http";
|
|
|
|
};
|
|
|
|
};
|
2023-03-23 00:00:29 +02:00
|
|
|
hostLinks = lib.mkMerge [
|
|
|
|
(lib.genAttrs (with cfg.nodes; master ++ slave) (node: {
|
|
|
|
dnsAuthoritative = {
|
|
|
|
ipv4 = hours.${node}.interfaces.primary.addrPublic;
|
|
|
|
port = 53;
|
|
|
|
};
|
|
|
|
}))
|
|
|
|
(lib.genAttrs cfg.nodes.coredns (node: {
|
|
|
|
dnsResolver = {
|
|
|
|
ipv4 = config.vars.mesh.${node}.meshIp;
|
|
|
|
port = 53;
|
|
|
|
};
|
|
|
|
}))
|
|
|
|
(lib.genAttrs cfg.nodes.coredns (node: {
|
|
|
|
dnsResolverBackend = {
|
|
|
|
ipv4 = config.vars.mesh.${node}.meshIp;
|
|
|
|
};
|
|
|
|
}))
|
|
|
|
];
|
2022-08-07 20:58:37 +03:00
|
|
|
services.dns = {
|
|
|
|
nodes = {
|
|
|
|
master = [ "VEGAS" ];
|
2023-03-06 17:21:40 +02:00
|
|
|
slave = [ "checkmate" "prophet" ];
|
2023-03-23 00:00:29 +02:00
|
|
|
coredns = [ "checkmate" "VEGAS" ];
|
2023-03-23 00:27:35 +02:00
|
|
|
client = [ "checkmate" "thunderskin" "VEGAS" "prophet" ];
|
2022-08-07 20:58:37 +03:00
|
|
|
};
|
|
|
|
nixos = {
|
|
|
|
master = [
|
|
|
|
./authoritative.nix
|
|
|
|
./admin.nix
|
|
|
|
];
|
|
|
|
slave = ./authoritative.nix;
|
|
|
|
coredns = ./coredns.nix;
|
2022-08-07 21:01:27 +03:00
|
|
|
client = ./client.nix;
|
2022-08-07 20:58:37 +03:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|