clightning: add regtest support

This commit is contained in:
Erik Arvstedt 2020-10-16 17:43:01 +02:00
parent c24ac5d363
commit 0f32f3c99e
No known key found for this signature in database
GPG Key ID: 33312B944DD97846

View File

@ -6,8 +6,9 @@ let
cfg = config.services.clightning; cfg = config.services.clightning;
inherit (config) nix-bitcoin-services; inherit (config) nix-bitcoin-services;
onion-chef-service = (if cfg.announce-tor then [ "onion-chef.service" ] else []); onion-chef-service = (if cfg.announce-tor then [ "onion-chef.service" ] else []);
network = config.services.bitcoind.makeNetworkName "bitcoin" "regtest";
configFile = pkgs.writeText "config" '' configFile = pkgs.writeText "config" ''
network=bitcoin network=${network}
bitcoin-datadir=${config.services.bitcoind.dataDir} bitcoin-datadir=${config.services.bitcoind.dataDir}
${optionalString (cfg.proxy != null) "proxy=${cfg.proxy}"} ${optionalString (cfg.proxy != null) "proxy=${cfg.proxy}"}
always-use-proxy=${if cfg.always-use-proxy then "true" else "false"} always-use-proxy=${if cfg.always-use-proxy then "true" else "false"}
@ -135,11 +136,11 @@ in {
); );
# Wait until the rpc socket appears # Wait until the rpc socket appears
postStart = '' postStart = ''
while [[ ! -e ${cfg.dataDir}/bitcoin/lightning-rpc ]]; do while [[ ! -e ${cfg.dataDir}/${network}/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}/bitcoin chmod g+x ${cfg.dataDir}/${network}
''; '';
}; };
}; };