2020-04-24 23:36:52 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.services.powerdns;
|
|
|
|
configDir = pkgs.writeTextDir "pdns.conf" "${cfg.extraConfig}";
|
|
|
|
in {
|
|
|
|
options = {
|
|
|
|
services.powerdns = {
|
2020-10-27 00:29:36 +00:00
|
|
|
enable = mkEnableOption "PowerDNS domain name server";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
extraConfig = mkOption {
|
|
|
|
type = types.lines;
|
|
|
|
default = "launch=bind";
|
|
|
|
description = ''
|
2020-10-27 00:29:36 +00:00
|
|
|
PowerDNS configuration. Refer to
|
|
|
|
<link xlink:href="https://doc.powerdns.com/authoritative/settings.html"/>
|
|
|
|
for details on supported values.
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2020-10-27 00:29:36 +00:00
|
|
|
config = mkIf cfg.enable {
|
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
systemd.packages = [ pkgs.pdns ];
|
2020-10-27 00:29:36 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
systemd.services.pdns = {
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
2020-10-27 00:29:36 +00:00
|
|
|
after = [ "network.target" "mysql.service" "postgresql.service" "openldap.service" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
serviceConfig = {
|
2022-03-30 09:31:56 +00:00
|
|
|
ExecStart = [ "" "${pkgs.pdns}/bin/pdns_server --config-dir=${configDir} --guardian=no --daemon=no --disable-syslog --log-timestamp=no --write-pid=no" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
};
|
2020-10-27 00:29:36 +00:00
|
|
|
|
|
|
|
users.users.pdns = {
|
|
|
|
isSystemUser = true;
|
|
|
|
group = "pdns";
|
|
|
|
description = "PowerDNS";
|
|
|
|
};
|
|
|
|
|
|
|
|
users.groups.pdns = {};
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|