From 70d3697f8c913b25e4632cb483834031c25fd1a1 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Thu, 20 Jan 2022 18:21:56 +0000 Subject: [PATCH] nixos/resolvconf: allow disabling For systems without internet connections, it doesn't make sense to require the existence of an /etc/resolv.conf file to disable resolvconf, so let's expose networking.resolveconf.enable as a public option that can be set to false. --- nixos/modules/config/resolvconf.nix | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/nixos/modules/config/resolvconf.nix b/nixos/modules/config/resolvconf.nix index cd0ed491383c..4499481811fd 100644 --- a/nixos/modules/config/resolvconf.nix +++ b/nixos/modules/config/resolvconf.nix @@ -47,8 +47,8 @@ in enable = mkOption { type = types.bool; - default = false; - internal = true; + default = !(config.environment.etc ? "resolv.conf"); + defaultText = literalExpression ''!(config.environment.etc ? "resolv.conf")''; description = '' DNS configuration is managed by resolvconf. ''; @@ -110,8 +110,6 @@ in config = mkMerge [ { - networking.resolvconf.enable = !(config.environment.etc ? "resolv.conf"); - environment.etc."resolvconf.conf".text = if !cfg.enable then # Force-stop any attempts to use resolvconf