bitcoind: support onion address announcing

This commit is contained in:
Erik Arvstedt 2021-01-30 10:47:06 +01:00
parent 9662c19ab1
commit 332d0e70c8
No known key found for this signature in database
GPG key ID: 33312B944DD97846
2 changed files with 16 additions and 0 deletions

View file

@ -67,6 +67,14 @@ in {
default = 8333;
description = "Port to listen for peer connections.";
};
getPublicAddressCmd = mkOption {
type = types.str;
default = "";
description = ''
Bash expression which outputs the public service address to announce to peers.
If left empty, no address is announced.
'';
};
package = mkOption {
type = types.package;
default = config.nix-bitcoin.pkgs.bitcoind;
@ -328,6 +336,10 @@ in {
${extraRpcauth}
${/* Enable bitcoin-cli for group 'bitcoin' */ ""}
printf "rpcuser=${cfg.rpc.users.privileged.name}\nrpcpassword="; cat "${secretsDir}/bitcoin-rpcpassword-privileged";
echo
${optionalString (cfg.getPublicAddressCmd != "") ''
echo "externalip=$(${cfg.getPublicAddressCmd})"
''}
)
confFile='${cfg.dataDir}/bitcoin.conf'
if [[ ! -e $confFile || $cfg != $(cat $confFile) ]]; then