summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2022-01-20 18:21:56 +0000
committerAlyssa Ross <hi@alyssa.is>2022-03-22 21:18:02 +0000
commitcd18f5574aca8a2251eacba1b489bfb96fde527e (patch)
treefd8ff24d2a74efd3c1efe2d5e5740e34b396270f
parent1335d2450f16d5b3edc6dc764d152525ca13cd90 (diff)
downloadnixpkgs-cd18f5574aca8a2251eacba1b489bfb96fde527e.tar
nixpkgs-cd18f5574aca8a2251eacba1b489bfb96fde527e.tar.gz
nixpkgs-cd18f5574aca8a2251eacba1b489bfb96fde527e.tar.bz2
nixpkgs-cd18f5574aca8a2251eacba1b489bfb96fde527e.tar.lz
nixpkgs-cd18f5574aca8a2251eacba1b489bfb96fde527e.tar.xz
nixpkgs-cd18f5574aca8a2251eacba1b489bfb96fde527e.tar.zst
nixpkgs-cd18f5574aca8a2251eacba1b489bfb96fde527e.zip
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.
-rw-r--r--nixos/modules/config/resolvconf.nix6
1 files changed, 2 insertions, 4 deletions
diff --git a/nixos/modules/config/resolvconf.nix b/nixos/modules/config/resolvconf.nix
index cd0ed491383..4499481811f 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