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>.";
|
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;
|
enforceTor = nix-bitcoin-services.enforceTor;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -77,6 +77,7 @@ in {
|
|||||||
path = with pkgs; [
|
path = with pkgs; [
|
||||||
nix-bitcoin.nodeinfo
|
nix-bitcoin.nodeinfo
|
||||||
config.services.clightning.cli
|
config.services.clightning.cli
|
||||||
|
config.services.lnd.cli
|
||||||
jq
|
jq
|
||||||
sudo
|
sudo
|
||||||
];
|
];
|
||||||
|
@ -102,9 +102,6 @@ in {
|
|||||||
services.onion-chef.access.operator = [ "bitcoind" "clightning" "nginx" "liquidd" "spark-wallet" "electrs" "sshd" ];
|
services.onion-chef.access.operator = [ "bitcoind" "clightning" "nginx" "liquidd" "spark-wallet" "electrs" "sshd" ];
|
||||||
|
|
||||||
environment.interactiveShellInit = ''
|
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) ''
|
${optionalString (config.services.liquidd.enable) ''
|
||||||
alias elements-cli='elements-cli -datadir=${config.services.liquidd.dataDir}'
|
alias elements-cli='elements-cli -datadir=${config.services.liquidd.dataDir}'
|
||||||
alias liquidswap-cli='liquidswap-cli -c ${config.services.liquidd.dataDir}/elements.conf'
|
alias liquidswap-cli='liquidswap-cli -c ${config.services.liquidd.dataDir}/elements.conf'
|
||||||
@ -173,7 +170,7 @@ in {
|
|||||||
qrencode
|
qrencode
|
||||||
]
|
]
|
||||||
++ optionals config.services.clightning.enable [clightning (hiPrio config.services.clightning.cli)]
|
++ 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.lightning-charge.enable [lightning-charge]
|
||||||
++ optionals config.services.nanopos.enable [nanopos]
|
++ optionals config.services.nanopos.enable [nanopos]
|
||||||
++ optionals config.services.nix-bitcoin-webindex.enable [nginx]
|
++ optionals config.services.nix-bitcoin-webindex.enable [nginx]
|
||||||
|
@ -14,7 +14,7 @@ if [ -x "$(command -v lightning-cli)" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -x "$(command -v lncli)" ]; then
|
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"
|
echo LND_NODEID="$LND_NODEID"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user