lnd: add cli option
This commit is contained in:
parent
1833b15888
commit
cd5ed39b9c
|
@ -88,6 +88,16 @@ in {
|
|||
'';
|
||||
description = "Additional configurations to be appended to <filename>lnd.conf</filename>.";
|
||||
};
|
||||
cli = mkOption {
|
||||
readOnly = true;
|
||||
default = pkgs.writeScriptBin "lncli"
|
||||
# Switch user because lnd makes datadir contents readable by user only
|
||||
''
|
||||
exec sudo -u lnd ${pkgs.nix-bitcoin.lnd}/bin/lncli --tlscertpath /secrets/lnd_cert \
|
||||
--macaroonpath '${cfg.dataDir}/chain/bitcoin/mainnet/admin.macaroon' "$@"
|
||||
'';
|
||||
description = "Binary to connect with the lnd instance.";
|
||||
};
|
||||
enforceTor = nix-bitcoin-services.enforceTor;
|
||||
};
|
||||
|
||||
|
|
|
@ -77,6 +77,7 @@ in {
|
|||
path = with pkgs; [
|
||||
nix-bitcoin.nodeinfo
|
||||
config.services.clightning.cli
|
||||
config.services.lnd.cli
|
||||
jq
|
||||
sudo
|
||||
];
|
||||
|
|
|
@ -102,9 +102,6 @@ in {
|
|||
services.onion-chef.access.operator = [ "bitcoind" "clightning" "nginx" "liquidd" "spark-wallet" "electrs" "sshd" ];
|
||||
|
||||
environment.interactiveShellInit = ''
|
||||
${optionalString (config.services.lnd.enable) ''
|
||||
alias lncli='sudo -u lnd lncli --tlscertpath /secrets/lnd_cert --macaroonpath ${config.services.lnd.dataDir}/chain/bitcoin/mainnet/admin.macaroon'
|
||||
''}
|
||||
${optionalString (config.services.liquidd.enable) ''
|
||||
alias elements-cli='elements-cli -datadir=${config.services.liquidd.dataDir}'
|
||||
alias liquidswap-cli='liquidswap-cli -c ${config.services.liquidd.dataDir}/elements.conf'
|
||||
|
@ -173,7 +170,7 @@ in {
|
|||
qrencode
|
||||
]
|
||||
++ optionals config.services.clightning.enable [clightning (hiPrio config.services.clightning.cli)]
|
||||
++ optionals config.services.lnd.enable [lnd]
|
||||
++ optionals config.services.lnd.enable [lnd (hiPrio config.services.lnd.cli)]
|
||||
++ optionals config.services.lightning-charge.enable [lightning-charge]
|
||||
++ optionals config.services.nanopos.enable [nanopos]
|
||||
++ optionals config.services.nix-bitcoin-webindex.enable [nginx]
|
||||
|
|
|
@ -14,7 +14,7 @@ if [ -x "$(command -v lightning-cli)" ]; then
|
|||
fi
|
||||
|
||||
if [ -x "$(command -v lncli)" ]; then
|
||||
LND_NODEID=$(sudo -u lnd lncli --tlscertpath /secrets/lnd_cert --macaroonpath /var/lib/lnd/chain/bitcoin/mainnet/admin.macaroon getinfo | jq -r '.uris[0]')
|
||||
LND_NODEID=$(lncli getinfo | jq -r '.uris[0]')
|
||||
echo LND_NODEID="$LND_NODEID"
|
||||
fi
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user