From 25adce29e508bf9013b5dc8096d5d1926e5f9542 Mon Sep 17 00:00:00 2001 From: nixbitcoin Date: Thu, 9 Jul 2020 11:08:39 +0000 Subject: [PATCH] secure-node: only mkHiddenServices if services are enabled --- modules/presets/secure-node.nix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/presets/secure-node.nix b/modules/presets/secure-node.nix index d8ece9e..269557e 100644 --- a/modules/presets/secure-node.nix +++ b/modules/presets/secure-node.nix @@ -84,14 +84,14 @@ in { enforceTor = true; always-use-proxy = true; }; - services.tor.hiddenServices.clightning = mkHiddenService { port = cfg.clightning.onionport; toHost = (builtins.head (builtins.split ":" cfg.clightning.bind-addr)); }; + services.tor.hiddenServices.clightning = mkIf cfg.clightning.enable (mkHiddenService { port = cfg.clightning.onionport; toHost = (builtins.head (builtins.split ":" cfg.clightning.bind-addr)); }); # lnd services.lnd = { tor-socks = cfg.tor.client.socksListenAddress; enforceTor = true; }; - services.tor.hiddenServices.lnd = mkHiddenService { port = cfg.lnd.onionport; toHost = cfg.lnd.listen; }; + services.tor.hiddenServices.lnd = mkIf cfg.lnd.enable (mkHiddenService { port = cfg.lnd.onionport; toHost = cfg.lnd.listen; }); # liquidd services.liquidd = { @@ -107,7 +107,7 @@ in { enforceTor = true; port = 7042; }; - services.tor.hiddenServices.liquidd = mkHiddenService { port = cfg.liquidd.port; toHost = cfg.liquidd.bind; }; + services.tor.hiddenServices.liquidd = mkIf cfg.liquidd.enable (mkHiddenService { port = cfg.liquidd.port; toHost = cfg.liquidd.bind; }); # electrs services.electrs = { @@ -116,11 +116,11 @@ in { TLSProxy.enable = true; TLSProxy.port = 50003; }; - services.tor.hiddenServices.electrs = mkHiddenService { + services.tor.hiddenServices.electrs = mkIf cfg.electrs.enable (mkHiddenService { port = cfg.electrs.onionport; toPort = if cfg.electrs.TLSProxy.enable then cfg.electrs.TLSProxy.port else cfg.electrs.port; toHost = cfg.electrs.host; - }; + }); services.spark-wallet = { onion-service = true;