at 23.05-pre 1.2 kB view raw
1{ config, lib, pkgs, ... }: 2 3with lib; 4 5let 6 cfg = config.services.powerdns; 7 configDir = pkgs.writeTextDir "pdns.conf" "${cfg.extraConfig}"; 8in { 9 options = { 10 services.powerdns = { 11 enable = mkEnableOption (lib.mdDoc "PowerDNS domain name server"); 12 13 extraConfig = mkOption { 14 type = types.lines; 15 default = "launch=bind"; 16 description = lib.mdDoc '' 17 PowerDNS configuration. Refer to 18 <https://doc.powerdns.com/authoritative/settings.html> 19 for details on supported values. 20 ''; 21 }; 22 }; 23 }; 24 25 config = mkIf cfg.enable { 26 27 systemd.packages = [ pkgs.pdns ]; 28 29 systemd.services.pdns = { 30 wantedBy = [ "multi-user.target" ]; 31 after = [ "network.target" "mysql.service" "postgresql.service" "openldap.service" ]; 32 33 serviceConfig = { 34 ExecStart = [ "" "${pkgs.pdns}/bin/pdns_server --config-dir=${configDir} --guardian=no --daemon=no --disable-syslog --log-timestamp=no --write-pid=no" ]; 35 }; 36 }; 37 38 users.users.pdns = { 39 isSystemUser = true; 40 group = "pdns"; 41 description = "PowerDNS"; 42 }; 43 44 users.groups.pdns = {}; 45 46 }; 47}