Merge pull request #218280 from thequux/set-pdns-config-dir

powerdns, pdns-recursor: find config in /etc by default
This commit is contained in:
Nick Cao 2023-07-01 20:18:22 +08:00 committed by GitHub
commit 99d4bf7bab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 7 deletions

View File

@ -159,6 +159,8 @@ in {
config = mkIf cfg.enable {
environment.etc."pdns-recursor".source = configDir;
services.pdns-recursor.settings = mkDefaultAttrs {
local-address = cfg.dns.address;
local-port = cfg.dns.port;

View File

@ -38,6 +38,8 @@ in {
config = mkIf cfg.enable {
environment.etc.pdns.source = finalConfigDir;
systemd.packages = [ pkgs.pdns ];
systemd.services.pdns = {

View File

@ -28,8 +28,6 @@ import ./make-test-python.nix ({ pkgs, lib, ... }: {
};
testScript = ''
import re
with subtest("PowerDNS database exists"):
server.wait_for_unit("mysql")
server.succeed("echo 'SHOW DATABASES;' | sudo -u pdns mysql -u pdns >&2")
@ -46,11 +44,7 @@ import ./make-test-python.nix ({ pkgs, lib, ... }: {
with subtest("Adding an example zone works"):
# Extract configuration file needed by pdnsutil
unit = server.succeed("systemctl cat pdns")
match = re.search("(--config-dir=[^ ]+)", unit)
assert(match is not None)
conf = match.group(1)
pdnsutil = "sudo -u pdns pdnsutil " + conf
pdnsutil = "sudo -u pdns pdnsutil "
server.succeed(f"{pdnsutil} create-zone example.com ns1.example.com")
server.succeed(f"{pdnsutil} add-record example.com ns1 A 192.168.1.2")

View File

@ -21,8 +21,11 @@ stdenv.mkDerivation rec {
configureFlags = [
"--enable-reproducible"
"--enable-systemd"
"sysconfdir=/etc/pdns-recursor"
];
installFlags = [ "sysconfdir=$(out)/etc/pdns-recursor" ];
enableParallelBuilding = true;
passthru.tests = {

View File

@ -69,6 +69,7 @@ stdenv.mkDerivation (finalAttrs: {
"--with-libsodium"
"--with-sqlite3"
"--with-libcrypto=${openssl.dev}"
"sysconfdir=/etc/pdns"
];
# nix destroy with-modules arguments, when using configureFlags
@ -79,6 +80,11 @@ stdenv.mkDerivation (finalAttrs: {
)
'';
# We want the various utilities to look for the powerdns config in
# /etc/pdns, but to actually install the sample config file in
# $out
installFlags = [ "sysconfdir=$(out)/etc/pdns" ];
enableParallelBuilding = true;
doCheck = true;