From b2019639511ac305f6d79eeab74e41d76028a402 Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Fri, 11 Jul 2025 03:08:18 +0200 Subject: [PATCH] nixos/postfix-tlspol: only preset dns resolver with useLocalResolver This is the best indicator we have about whether to use a local resolver. In the meantime I'm lobbying upstream to read /etc/resolv.conf. --- nixos/modules/services/mail/postfix-tlspol.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/nixos/modules/services/mail/postfix-tlspol.nix b/nixos/modules/services/mail/postfix-tlspol.nix index a44ccbdba652..12423c50fd8b 100644 --- a/nixos/modules/services/mail/postfix-tlspol.nix +++ b/nixos/modules/services/mail/postfix-tlspol.nix @@ -8,6 +8,7 @@ let inherit (lib) hasPrefix + literalExpression mkEnableOption mkIf mkMerge @@ -92,7 +93,13 @@ in dns = { address = mkOption { type = types.str; - default = "127.0.0.1:53"; + default = if config.networking.resolvconf.useLocalResolver then "127.0.0.1:53" else null; + defaultText = literalExpression '' + if config.networking.resolvconf.useLocalResolver then + "127.0.0.1:53" + else + null + ''; description = '' IP and port to your DNS resolver