2023-03-23 00:00:29 +02:00
|
|
|
{ config, depot, lib, ... }:
|
2022-08-07 20:58:37 +03:00
|
|
|
|
|
|
|
let
|
2023-08-31 01:55:45 +03:00
|
|
|
inherit (depot) hours;
|
2023-03-23 00:00:29 +02:00
|
|
|
cfg = config.services.dns;
|
2022-08-07 20:58:37 +03:00
|
|
|
in
|
|
|
|
{
|
2023-11-03 00:11:13 +02:00
|
|
|
imports = [
|
|
|
|
./options.nix
|
2023-12-03 17:32:00 +02:00
|
|
|
./nodes.nix
|
2023-12-03 18:29:27 +02:00
|
|
|
./ns-records.nix
|
2023-11-03 00:11:13 +02:00
|
|
|
];
|
|
|
|
|
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;
|
|
|
|
};
|
2023-12-03 17:30:16 +02:00
|
|
|
acmeDnsApi = {
|
|
|
|
hostname = "acme-dns-challenge.internal.${depot.lib.meta.domain}";
|
2022-08-07 20:58:37 +03:00
|
|
|
protocol = "http";
|
|
|
|
};
|
|
|
|
};
|
2023-03-23 00:00:29 +02:00
|
|
|
hostLinks = lib.mkMerge [
|
2023-12-03 17:30:16 +02:00
|
|
|
(lib.genAttrs cfg.nodes.authoritative (node: {
|
2023-03-23 00:00:29 +02:00
|
|
|
dnsAuthoritative = {
|
|
|
|
ipv4 = hours.${node}.interfaces.primary.addrPublic;
|
|
|
|
port = 53;
|
|
|
|
};
|
2023-12-03 17:30:16 +02:00
|
|
|
acmeDnsApi = {
|
|
|
|
ipv4 = config.vars.mesh.${node}.meshIp;
|
|
|
|
inherit (config.links.acmeDnsApi) port;
|
|
|
|
protocol = "http";
|
|
|
|
};
|
2023-03-23 00:00:29 +02:00
|
|
|
}))
|
|
|
|
(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 = {
|
2023-12-03 17:30:16 +02:00
|
|
|
authoritative = [ "VEGAS" "checkmate" "prophet" ];
|
2023-03-23 00:00:29 +02:00
|
|
|
coredns = [ "checkmate" "VEGAS" ];
|
2023-11-04 02:07:35 +02:00
|
|
|
client = [ "checkmate" "grail" "thunderskin" "VEGAS" "prophet" ];
|
2022-08-07 20:58:37 +03:00
|
|
|
};
|
|
|
|
nixos = {
|
2023-12-03 17:30:16 +02:00
|
|
|
authoritative = ./authoritative.nix;
|
2022-08-07 20:58:37 +03:00
|
|
|
coredns = ./coredns.nix;
|
2022-08-07 21:01:27 +03:00
|
|
|
client = ./client.nix;
|
2022-08-07 20:58:37 +03:00
|
|
|
};
|
2024-08-16 03:16:28 +03:00
|
|
|
simulacrum = {
|
|
|
|
enable = true;
|
|
|
|
deps = [ "consul" "acme-client" "patroni" ];
|
|
|
|
settings = ./test.nix;
|
|
|
|
};
|
2022-08-07 20:58:37 +03:00
|
|
|
};
|
2023-11-03 00:21:22 +02:00
|
|
|
|
2024-08-10 14:06:59 +03:00
|
|
|
patroni = {
|
|
|
|
databases.acmedns = {};
|
|
|
|
users.acmedns = {
|
|
|
|
locksmith = {
|
|
|
|
nodes = config.services.dns.nodes.authoritative;
|
|
|
|
format = "envFile";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2023-12-03 17:30:16 +02:00
|
|
|
dns.records = {
|
|
|
|
securedns.consulService = "securedns";
|
|
|
|
"acme-dns-challenge.internal".consulService = "acme-dns";
|
|
|
|
};
|
2022-08-07 20:58:37 +03:00
|
|
|
}
|