From 51b09612146b8bf94f609f0147d35a3e9ffe2e03 Mon Sep 17 00:00:00 2001 From: Ryan Horiguchi Date: Sat, 26 Jul 2025 19:18:26 +0200 Subject: [PATCH] nixos/dnsmasq: add config option to retrive config file path --- nixos/modules/services/networking/dnsmasq.nix | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/nixos/modules/services/networking/dnsmasq.nix b/nixos/modules/services/networking/dnsmasq.nix index b345b51d4bda..fcfe21101839 100644 --- a/nixos/modules/services/networking/dnsmasq.nix +++ b/nixos/modules/services/networking/dnsmasq.nix @@ -117,8 +117,10 @@ in configFile = lib.mkOption { type = lib.types.package; - default = dnsmasqConf; - internal = true; + readOnly = true; + description = '' + Path to the configuration file of dnsmasq. + ''; }; }; @@ -129,10 +131,14 @@ in config = lib.mkIf cfg.enable { - services.dnsmasq.settings = { - dhcp-leasefile = lib.mkDefault "${stateDir}/dnsmasq.leases"; - conf-file = lib.mkDefault (lib.optional cfg.resolveLocalQueries "/etc/dnsmasq-conf.conf"); - resolv-file = lib.mkDefault (lib.optional cfg.resolveLocalQueries "/etc/dnsmasq-resolv.conf"); + services.dnsmasq = { + settings = { + dhcp-leasefile = lib.mkDefault "${stateDir}/dnsmasq.leases"; + 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";