summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorAndreas Rammhold <andreas@rammhold.de>2021-07-21 22:08:44 +0200
committerGitHub <noreply@github.com>2021-07-21 22:08:44 +0200
commitef9be9288ba44656f5b9b9f0f64ff50dcfd3f1c2 (patch)
treef9f9c0be9ddaf35d760f2b735590ef93544e287b /nixos
parent1e41d06dd78940e8a292ef42b74d7dab2ef01ac4 (diff)
parent6b12cff0b5746af364066d1bcb2bc2563e978aa8 (diff)
downloadnixpkgs-ef9be9288ba44656f5b9b9f0f64ff50dcfd3f1c2.tar
nixpkgs-ef9be9288ba44656f5b9b9f0f64ff50dcfd3f1c2.tar.gz
nixpkgs-ef9be9288ba44656f5b9b9f0f64ff50dcfd3f1c2.tar.bz2
nixpkgs-ef9be9288ba44656f5b9b9f0f64ff50dcfd3f1c2.tar.lz
nixpkgs-ef9be9288ba44656f5b9b9f0f64ff50dcfd3f1c2.tar.xz
nixpkgs-ef9be9288ba44656f5b9b9f0f64ff50dcfd3f1c2.tar.zst
nixpkgs-ef9be9288ba44656f5b9b9f0f64ff50dcfd3f1c2.zip
Merge pull request #124799 from rissson/nixos-unbound-fix-124780
nixos/unbound: fix define-tag option
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/networking/unbound.nix11
1 files changed, 10 insertions, 1 deletions
diff --git a/nixos/modules/services/networking/unbound.nix b/nixos/modules/services/networking/unbound.nix
index 09aef9a1dcf..6d7178047ea 100644
--- a/nixos/modules/services/networking/unbound.nix
+++ b/nixos/modules/services/networking/unbound.nix
@@ -21,7 +21,15 @@ let
                                 ))
     else throw (traceSeq v "services.unbound.settings: unexpected type");
 
-  confFile = pkgs.writeText "unbound.conf" (concatStringsSep "\n" ((mapAttrsToList (toConf "") cfg.settings) ++ [""]));
+  confNoServer = concatStringsSep "\n" ((mapAttrsToList (toConf "") (builtins.removeAttrs cfg.settings [ "server" ])) ++ [""]);
+  confServer = concatStringsSep "\n" (mapAttrsToList (toConf "  ") (builtins.removeAttrs cfg.settings.server [ "define-tag" ]));
+
+  confFile = pkgs.writeText "unbound.conf" ''
+    server:
+    ${optionalString (cfg.settings.server.define-tag != "") (toOption "  " "define-tag" cfg.settings.server.define-tag)}
+    ${confServer}
+    ${confNoServer}
+  '';
 
   rootTrustAnchorFile = "${cfg.stateDir}/root.key";
 
@@ -170,6 +178,7 @@ in {
         # prevent race conditions on system startup when interfaces are not yet
         # configured
         ip-freebind = mkDefault true;
+        define-tag = mkDefault "";
       };
       remote-control = {
         control-enable = mkDefault false;