From ac96fd59dbcfd81c743deb9c29b4845485f1d48b Mon Sep 17 00:00:00 2001 From: nixbitcoin Date: Tue, 4 Aug 2020 07:54:01 +0000 Subject: [PATCH] assertions: make lnd.enable depend on !clightning.enable or port != 9735 --- examples/configuration.nix | 6 ++++-- modules/modules.nix | 7 ++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/examples/configuration.nix b/examples/configuration.nix index f1030ff..c1a28e9 100644 --- a/examples/configuration.nix +++ b/examples/configuration.nix @@ -44,8 +44,10 @@ # services.clightning.announce-tor = true; ### LND - # Disable clightning and uncomment the following line in order to enable lnd, - # a lightning implementation written in Go. + # Uncomment the following line in order to enable lnd, a lightning + # implementation written in Go. In order to avoid collisions with clightning + # you must disable clightning or change the services.clightning.bindport or + # services.lnd.listenPort to a port other than 9735. # services.lnd.enable = true; # Enable this option to announce our Tor Hidden Service. By default lnd # offers outgoing functionality, but doesn't announce the Tor Hidden Service diff --git a/modules/modules.nix b/modules/modules.nix index c3965d4..f509cc8 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -30,10 +30,11 @@ config = { assertions = [ - # lnd.wantedBy == [] needed for `test/tests.nix` in which both clightning and lnd are enabled - { assertion = config.services.lnd.enable -> (!config.services.clightning.enable || config.systemd.services.lnd.wantedBy == []); + { assertion = (config.services.lnd.enable -> ( !config.services.clightning.enable || config.services.clightning.bindport != config.services.lnd.listenPort)); message = '' - LND and clightning can't be run in parallel because they both bind to lightning port 9735. + LND and clightning can't both bind to lightning port 9735. Either + disable LND/clightning or change services.clightning.bindPort or + services.lnd.listenPort to a port other than 9735. ''; } ];