liquid: add cli option

This commit is contained in:
Erik Arvstedt 2019-11-27 14:04:35 +01:00
parent cd5ed39b9c
commit 14ecb5511a
No known key found for this signature in database
GPG Key ID: 33312B944DD97846
2 changed files with 19 additions and 7 deletions

View File

@ -175,6 +175,20 @@ in {
Validate pegin claims. All functionaries must run this. Validate pegin claims. All functionaries must run this.
''; '';
}; };
cli = mkOption {
readOnly = true;
default = pkgs.writeScriptBin "elements-cli" ''
exec ${pkgs.nix-bitcoin.elementsd}/bin/elements-cli -datadir='${cfg.dataDir}' "$@"
'';
description = "Binary to connect with the liquidd instance.";
};
swap-cli = mkOption {
readOnly = true;
default = pkgs.writeScriptBin "liquidswap-cli" ''
exec ${pkgs.nix-bitcoin.liquid-swap}/bin/liquidswap-cli -c '${cfg.dataDir}/elements.conf' "$@"
'';
description = "Binary for managing liquid swaps.";
};
enforceTor = nix-bitcoin-services.enforceTor; enforceTor = nix-bitcoin-services.enforceTor;
}; };
}; };

View File

@ -101,12 +101,6 @@ in {
services.onion-chef.enable = true; services.onion-chef.enable = true;
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 = ''
${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'
''}
'';
# Unfortunately c-lightning doesn't allow setting the permissions of the rpc socket # Unfortunately c-lightning doesn't allow setting the permissions of the rpc socket
# https://github.com/ElementsProject/lightning/issues/1366 # https://github.com/ElementsProject/lightning/issues/1366
security.sudo.configFile = ( security.sudo.configFile = (
@ -174,7 +168,11 @@ in {
++ 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]
++ optionals config.services.liquidd.enable [elementsd liquid-swap] ++ optionals config.services.liquidd.enable [
elementsd
(hiPrio config.services.liquidd.cli)
(hiPrio config.services.liquidd.swap-cli)
]
++ optionals config.services.spark-wallet.enable [spark-wallet] ++ optionals config.services.spark-wallet.enable [spark-wallet]
++ optionals config.services.electrs.enable [electrs] ++ optionals config.services.electrs.enable [electrs]
++ optionals (config.services.hardware-wallets.ledger || config.services.hardware-wallets.trezor) [ ++ optionals (config.services.hardware-wallets.ledger || config.services.hardware-wallets.trezor) [