diff --git a/nixos/modules/services/networking/dnsmasq.nix b/nixos/modules/services/networking/dnsmasq.nix index 877705641cf1..644e573f3bb9 100644 --- a/nixos/modules/services/networking/dnsmasq.nix +++ b/nixos/modules/services/networking/dnsmasq.nix @@ -118,6 +118,8 @@ in configFile = lib.mkOption { type = lib.types.package; readOnly = true; + default = dnsmasqConf; + defaultText = lib.literalExpression "Path of dnsmasq config file"; description = '' Path to the configuration file of dnsmasq. ''; @@ -137,8 +139,6 @@ in conf-file = lib.mkDefault (lib.optional cfg.resolveLocalQueries "/etc/dnsmasq-conf.conf"); resolv-file = lib.mkDefault (lib.optional cfg.resolveLocalQueries "/etc/dnsmasq-resolv.conf"); }; - - configFile = dnsmasqConf; }; networking.nameservers = lib.optional cfg.resolveLocalQueries "127.0.0.1"; diff --git a/nixos/tests/pihole-ftl/default.nix b/nixos/tests/pihole-ftl/default.nix index 71c971174dca..6277037013a3 100644 --- a/nixos/tests/pihole-ftl/default.nix +++ b/nixos/tests/pihole-ftl/default.nix @@ -2,4 +2,5 @@ { basic = runTest ./basic.nix; + dnsmasq = runTest ./dnsmasq.nix; } diff --git a/nixos/tests/pihole-ftl/dnsmasq.nix b/nixos/tests/pihole-ftl/dnsmasq.nix new file mode 100644 index 000000000000..66bd9bebb665 --- /dev/null +++ b/nixos/tests/pihole-ftl/dnsmasq.nix @@ -0,0 +1,20 @@ +let + port = "9077"; +in +{ + name = "pihole-ftl-dnsmasq"; + + nodes.machine = { + services.pihole-ftl = { + enable = true; + useDnsmasqConfig = true; + settings.webserver.port = port; + }; + }; + + testScript = '' + start_all() + machine.wait_for_unit("pihole-ftl.service") + machine.wait_for_open_port(${port}) + ''; +} diff --git a/pkgs/by-name/dn/dnsmasq/package.nix b/pkgs/by-name/dn/dnsmasq/package.nix index 3b7699cf87c0..6a05a0b02e3e 100644 --- a/pkgs/by-name/dn/dnsmasq/package.nix +++ b/pkgs/by-name/dn/dnsmasq/package.nix @@ -106,6 +106,7 @@ stdenv.mkDerivation rec { inherit (nixosTests) dnscrypt-proxy; kubernetes-dns-single = nixosTests.kubernetes.dns-single-node; kubernetes-dns-multi = nixosTests.kubernetes.dns-multi-node; + pihole-ftl-dnsmasq = nixosTests.pihole-ftl.dnsmasq; }; meta = with lib; { diff --git a/pkgs/by-name/pi/pihole-ftl/package.nix b/pkgs/by-name/pi/pihole-ftl/package.nix index 3e7d48e7393b..c6838e9ea700 100644 --- a/pkgs/by-name/pi/pihole-ftl/package.nix +++ b/pkgs/by-name/pi/pihole-ftl/package.nix @@ -77,8 +77,11 @@ stdenv.mkDerivation (finalAttrs: { runHook postInstall ''; - passthru.settingsTemplate = ./pihole.toml; - passthru.tests = nixosTests.pihole-ftl; + passthru = { + settingsTemplate = ./pihole.toml; + + tests = nixosTests.pihole-ftl; + }; meta = { description = "Pi-hole FTL engine";