From b882f644fc2d2a3d958c5335b928606cca44bef4 Mon Sep 17 00:00:00 2001 From: cnst Date: Sun, 7 Sep 2025 16:41:10 +0200 Subject: [PATCH] feat(unbound): adding dynamic host IP function --- modules/server/unbound/default.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/modules/server/unbound/default.nix b/modules/server/unbound/default.nix index a174ba6c..9e4b516d 100644 --- a/modules/server/unbound/default.nix +++ b/modules/server/unbound/default.nix @@ -7,6 +7,15 @@ let unit = "unbound"; cfg = config.server.${unit}; + + hostIp = + hostname: + if hostname == "ziggy" then + "192.168.88.12" + else if hostname == "sobotka" then + "192.168.88.14" + else + throw "No IP defined for host ${hostname}"; in { options.server.${unit} = { @@ -52,7 +61,7 @@ in infra-cache-slabs = 8; interface = [ "127.0.0.1@5335" - "192.168.88.14@5335" + "${hostIp config.networking.hostName}@5335" "::@5335" ]; key-cache-slabs = 8;