nixpkgs/nixos/modules/services/networking/powerdns.nix

48 lines
1.1 KiB
Nix
Raw Normal View History

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