From ae94665ad18ca3b49f485cce38bb4f2023de3f2e Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Sun, 22 May 2022 15:56:15 +0200 Subject: [PATCH] clightning: add `package` option --- modules/clightning.nix | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/modules/clightning.nix b/modules/clightning.nix index 32ea647..fd6bc5a 100644 --- a/modules/clightning.nix +++ b/modules/clightning.nix @@ -64,10 +64,16 @@ let default = cfg.user; description = "The group as which to run clightning."; }; + package = mkOption { + type = types.package; + default = nbPkgs.clightning; + defaultText = "config.nix-bitcoin.pkgs.clightning"; + description = "The package providing clightning binaries."; + }; cli = mkOption { readOnly = true; default = pkgs.writeScriptBin "lightning-cli" '' - ${nbPkgs.clightning}/bin/lightning-cli --lightning-dir='${cfg.dataDir}' "$@" + ${cfg.package}/bin/lightning-cli --lightning-dir='${cfg.dataDir}' "$@" ''; defaultText = "(See source)"; description = "Binary to connect with the clightning instance."; @@ -120,7 +126,7 @@ in { rpc.threads = 16; }; - environment.systemPackages = [ nbPkgs.clightning (hiPrio cfg.cli) ]; + environment.systemPackages = [ cfg.package (hiPrio cfg.cli) ]; systemd.tmpfiles.rules = [ "d '${cfg.dataDir}' 0770 ${cfg.user} ${cfg.group} - -" @@ -144,7 +150,7 @@ in { } > '${cfg.dataDir}/config' ''; serviceConfig = nbLib.defaultHardening // { - ExecStart = "${nbPkgs.clightning}/bin/lightningd --lightning-dir=${cfg.dataDir}"; + ExecStart = "${cfg.package}/bin/lightningd --lightning-dir=${cfg.dataDir}"; User = cfg.user; Restart = "on-failure"; RestartSec = "10s";