summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatt Christ <matt@christ.systems>2022-01-01 08:33:51 -0600
committerMatt Christ <matt@christ.systems>2022-01-01 08:33:51 -0600
commitc355b2729c01c4ea35a430dd6dfea9ae3848f816 (patch)
treebc7f2e70cd0b7943fe8e8eaa767c9bf4bed413c9
parentdf2c21de512180f349fde25d938185cfbd02b2e6 (diff)
downloadnixpkgs-c355b2729c01c4ea35a430dd6dfea9ae3848f816.tar
nixpkgs-c355b2729c01c4ea35a430dd6dfea9ae3848f816.tar.gz
nixpkgs-c355b2729c01c4ea35a430dd6dfea9ae3848f816.tar.bz2
nixpkgs-c355b2729c01c4ea35a430dd6dfea9ae3848f816.tar.lz
nixpkgs-c355b2729c01c4ea35a430dd6dfea9ae3848f816.tar.xz
nixpkgs-c355b2729c01c4ea35a430dd6dfea9ae3848f816.tar.zst
nixpkgs-c355b2729c01c4ea35a430dd6dfea9ae3848f816.zip
nixos/bind: configurable "forward" setting
Sometimes it is preferable to configure forwarding only for bind
instead of relying on direct lookups.

This patch makes it possible to configure the forward setting to
either "first" (the default) or "only".
-rw-r--r--nixos/modules/services/networking/bind.nix10
1 files changed, 9 insertions, 1 deletions
diff --git a/nixos/modules/services/networking/bind.nix b/nixos/modules/services/networking/bind.nix
index e44f8d4cf30..2045612ec05 100644
--- a/nixos/modules/services/networking/bind.nix
+++ b/nixos/modules/services/networking/bind.nix
@@ -59,7 +59,7 @@ let
         listen-on-v6 { ${concatMapStrings (entry: " ${entry}; ") cfg.listenOnIpv6} };
         allow-query { cachenetworks; };
         blackhole { badnetworks; };
-        forward first;
+        forward ${cfg.forward};
         forwarders { ${concatMapStrings (entry: " ${entry}; ") cfg.forwarders} };
         directory "${cfg.directory}";
         pid-file "/run/named/named.pid";
@@ -151,6 +151,14 @@ in
         ";
       };
 
+      forward = mkOption {
+        default = "first";
+        type = types.enum ["first" "only"];
+        description = "
+          Whether to forward 'first' (try forwarding but lookup directly if forwarding fails) or 'only'.
+        ";
+      };
+
       listenOn = mkOption {
         default = [ "any" ];
         type = types.listOf types.str;