spark-wallet: add regtest support

This commit is contained in:
Erik Arvstedt 2020-10-16 17:43:04 +02:00
parent 47d611b5ef
commit 937aee0062
No known key found for this signature in database
GPG Key ID: 33312B944DD97846
2 changed files with 9 additions and 11 deletions

View File

@ -68,6 +68,11 @@ in {
default = "/var/lib/clightning"; default = "/var/lib/clightning";
description = "The data directory for clightning."; description = "The data directory for clightning.";
}; };
networkDir = mkOption {
readOnly = true;
default = "${cfg.dataDir}/${network}";
description = "The network data directory.";
};
extraConfig = mkOption { extraConfig = mkOption {
type = types.lines; type = types.lines;
default = ""; default = "";
@ -119,7 +124,7 @@ in {
cp ${configFile} ${cfg.dataDir}/config cp ${configFile} ${cfg.dataDir}/config
chown -R '${cfg.user}:${cfg.group}' '${cfg.dataDir}' chown -R '${cfg.user}:${cfg.group}' '${cfg.dataDir}'
# The RPC socket has to be removed otherwise we might have stale sockets # The RPC socket has to be removed otherwise we might have stale sockets
rm -f ${cfg.dataDir}/bitcoin/lightning-rpc rm -f ${cfg.networkDir}/lightning-rpc
chmod 640 ${cfg.dataDir}/config chmod 640 ${cfg.dataDir}/config
echo "bitcoin-rpcpassword=$(cat ${config.nix-bitcoin.secretsDir}/bitcoin-rpcpassword-public)" >> '${cfg.dataDir}/config' echo "bitcoin-rpcpassword=$(cat ${config.nix-bitcoin.secretsDir}/bitcoin-rpcpassword-public)" >> '${cfg.dataDir}/config'
${optionalString cfg.announce-tor "echo announce-addr=$(cat /var/lib/onion-chef/clightning/clightning) >> '${cfg.dataDir}/config'"} ${optionalString cfg.announce-tor "echo announce-addr=$(cat /var/lib/onion-chef/clightning/clightning) >> '${cfg.dataDir}/config'"}
@ -136,11 +141,11 @@ in {
); );
# Wait until the rpc socket appears # Wait until the rpc socket appears
postStart = '' postStart = ''
while [[ ! -e ${cfg.dataDir}/${network}/lightning-rpc ]]; do while [[ ! -e ${cfg.networkDir}/lightning-rpc ]]; do
sleep 0.1 sleep 0.1
done done
# Needed to enable lightning-cli for users with group 'clightning' # Needed to enable lightning-cli for users with group 'clightning'
chmod g+x ${cfg.dataDir}/${network} chmod g+x ${cfg.networkDir}
''; '';
}; };
}; };

View File

@ -15,7 +15,7 @@ let
publicURL="--public-url http://$(cat /var/lib/onion-chef/spark-wallet/spark-wallet)" publicURL="--public-url http://$(cat /var/lib/onion-chef/spark-wallet/spark-wallet)"
''} ''}
exec ${pkgs.nix-bitcoin.spark-wallet}/bin/spark-wallet \ exec ${pkgs.nix-bitcoin.spark-wallet}/bin/spark-wallet \
--ln-path '${cfg.ln-path}' \ --ln-path '${config.services.clightning.networkDir}' \
--host ${cfg.host} \ --host ${cfg.host} \
--config '${config.nix-bitcoin.secretsDir}/spark-wallet-login' \ --config '${config.nix-bitcoin.secretsDir}/spark-wallet-login' \
${optionalString cfg.enforceTor torRateProvider} \ ${optionalString cfg.enforceTor torRateProvider} \
@ -36,13 +36,6 @@ in {
default = "localhost"; default = "localhost";
description = "http(s) server listen address."; description = "http(s) server listen address.";
}; };
ln-path = mkOption {
type = types.path;
default = "${config.services.clightning.dataDir}/bitcoin";
description = ''
"The path of the clightning network data directory.";
'';
};
onion-service = mkOption { onion-service = mkOption {
type = types.bool; type = types.bool;
default = false; default = false;