{ config, pkgs, ... }: let domain = config.networking.domain; ns_global = [ "2607:7c80:54:6::53" "204.87.183.53" ]; puck = [ "2602:fe55:5::5" "204.42.254.5" ]; comma = builtins.concatStringsSep ","; in { imports = [ ../settings/programs/sqlite.nix ]; age.secrets.powerdns.file = ../../secrets/powerdns.age; networking.firewall = { allowedTCPPorts = [ 53 ]; allowedUDPPorts = [ 53 ]; }; services.powerdns = { enable = true; secretFile = config.age.secrets.powerdns.path; extraConfig = '' local-address=:: launch=gsqlite3 dnsupdate=yes allow-dnsupdate-from=0.0.0.0/0,::/0 dnsupdate-require-tsig=yes also-notify=${comma ns_global} allow-axfr-ips=${comma (puck ++ ns_global)} expand-alias=yes outgoing-axfr-expand-alias=yes # needed with DNSSEC svc-autohints=yes resolver=2606:4700:4700::1111 log-dns-details=no log-dns-queries=no loglevel=5 primary=yes default-api-rectify=yes default-soa-edit=inception-increment api=yes # replaced by secretFile/envsubst api-key=$API_KEY gsqlite3-database=/var/db/pdns/zones.db gsqlite3-pragma-foreign-keys=yes gsqlite3-dnssec=yes ''; }; environment.systemPackages = [ pkgs.pdns ]; services.caddy.virtualHosts = { "pdns.${domain}" = { extraConfig = '' log { output discard } reverse_proxy 127.0.0.1:8081 ''; }; }; }