From 9f7d0487691c02ee2849ceb208ebd5c596381760 Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Sun, 15 Aug 2021 11:28:46 +0200 Subject: [PATCH] modules: move assertion to lnd.nix nix-bitcoin.nix is now no longer dependent on clightning.nix and lnd.nix. Due to condition '!(config.services ? clightning)' lnd.nix still doesn't depend on clightning.nix. Also fix the assertion message by renaming clightning.bindPort to clightning.port. --- modules/lnd.nix | 10 ++++++++++ modules/nix-bitcoin.nix | 12 ------------ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/modules/lnd.nix b/modules/lnd.nix index e4b591a..fcadc5c 100644 --- a/modules/lnd.nix +++ b/modules/lnd.nix @@ -157,6 +157,16 @@ in { { assertion = bitcoind.prune == 0; message = "lnd does not support bitcoind pruning."; } + { assertion = + !(config.services ? clightning) + || !config.services.clightning.enable + || config.services.clightning.port != cfg.port; + message = '' + LND and clightning can't both bind to lightning port 9735. Either + disable LND/clightning or change services.clightning.port or + services.lnd.port to a port other than 9735. + ''; + } ]; services.bitcoind = { diff --git a/modules/nix-bitcoin.nix b/modules/nix-bitcoin.nix index fc8696b..48cb7c4 100644 --- a/modules/nix-bitcoin.nix +++ b/modules/nix-bitcoin.nix @@ -41,16 +41,4 @@ with lib; }; }; }; - - config = { - assertions = [ - { assertion = (config.services.lnd.enable -> ( !config.services.clightning.enable || config.services.clightning.port != config.services.lnd.port)); - message = '' - LND and clightning can't both bind to lightning port 9735. Either - disable LND/clightning or change services.clightning.bindPort or - services.lnd.port to a port other than 9735. - ''; - } - ]; - }; }