From 23cd323ad12cabe4c3921234de480a2f94e50661 Mon Sep 17 00:00:00 2001 From: nixbitcoin Date: Mon, 15 Jun 2020 10:21:18 +0000 Subject: [PATCH] assertions: add lnd, clightning exclusivity --- examples/configuration.nix | 2 +- modules/modules.nix | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/examples/configuration.nix b/examples/configuration.nix index fa12f8c..7d4ff87 100644 --- a/examples/configuration.nix +++ b/examples/configuration.nix @@ -45,7 +45,7 @@ ### LND # Disable clightning and uncomment the following line in order to enable lnd, # a lightning implementation written in Go. - # services.lnd.enable = assert (!config.services.clightning.enable); true; + # services.lnd.enable = true; ## WARNING # If you use lnd, you should manually backup your wallet mnemonic # seed. This will allow you to recover on-chain funds. You can run the diff --git a/modules/modules.nix b/modules/modules.nix index faf12a7..93774c4 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -26,6 +26,15 @@ }; 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 == []); + message = '' + LND and clightning can't be run in parallel because they both bind to lightning port 9735. + ''; + } + ]; + nixpkgs.overlays = [ (self: super: { nix-bitcoin = let pkgs = import ../pkgs { pkgs = super; };