about summary refs log tree commit diff
path: root/modules/unbound.nix
diff options
context:
space:
mode:
authorazahi <azat@bahawi.net>2024-12-17 02:04:27 +0300
committerazahi <azat@bahawi.net>2024-12-17 02:04:27 +0300
commit1ae038a0a86348074b422ea87c03836b0962af67 (patch)
treeae56c73c01b4777e3e24a22c2d67943706997cf0 /modules/unbound.nix
parent2024-12-02 (diff)
2024-12-17 HEAD master
Diffstat (limited to 'modules/unbound.nix')
-rw-r--r--modules/unbound.nix20
1 files changed, 12 insertions, 8 deletions
diff --git a/modules/unbound.nix b/modules/unbound.nix
index e837f89..b8de321 100644
--- a/modules/unbound.nix
+++ b/modules/unbound.nix
@@ -65,10 +65,12 @@ in
                     "\"${domain}. A ${ipv4.address}\""
                     "\"${domain}. AAAA ${ipv6.address}\""
                   ]
-                  ++ concatMap (domain: [
-                    "\"${domain}. A ${ipv4.address}\""
-                    "\"${domain}. AAAA ${ipv6.address}\""
-                  ]) attr.domains
+                  ++ (optionals (hasAttr "domains" attr) (
+                    concatMap (domain: [
+                      "\"${domain}. A ${ipv4.address}\""
+                      "\"${domain}. AAAA ${ipv6.address}\""
+                    ]) attr.domains
+                  ))
                 ))
               ) my.configurations
             );
@@ -85,10 +87,12 @@ in
                     "\"${ipv4.address} ${domain}\""
                     "\"${ipv6.address} ${domain}\""
                   ]
-                  ++ concatMap (domain: [
-                    "\"${ipv4.address} ${domain}\""
-                    "\"${ipv6.address} ${domain}\""
-                  ]) attr.domains
+                  ++ (optionals (hasAttr "domains" attr) (
+                    concatMap (domain: [
+                      "\"${ipv4.address} ${domain}\""
+                      "\"${ipv6.address} ${domain}\""
+                    ]) attr.domains
+                  ))
                 ))
               ) my.configurations
             );

Consider giving Nix/NixOS a try! <3