diff --git a/modules/nixbitcoin.nix b/modules/nixbitcoin.nix index 9707368..57640d2 100644 --- a/modules/nixbitcoin.nix +++ b/modules/nixbitcoin.nix @@ -60,13 +60,14 @@ in { after = [ "clightning.service" "tor.service" ]; path = [ pkgs.clightning pkgs.jq pkgs.sudo ]; serviceConfig = { - ExecStart="${pkgs.bash}/bin/bash ${pkgs.nodeinfo}/bin/nodeinfo"; + ExecStart="${pkgs.bash}/bin/bash ${pkgs.nodeinfo}/bin/nodeinfo > /var/lib/nodeinfo.nix"; User = "root"; Type = "simple"; RemainAfterExit="yes"; Restart = "on-failure"; RestartSec = "10s"; }; + }; # Define a user account. Don't forget to set a password with ‘passwd’. diff --git a/pkgs/nodeinfo.sh b/pkgs/nodeinfo.sh index f1f9756..6d8033e 100644 --- a/pkgs/nodeinfo.sh +++ b/pkgs/nodeinfo.sh @@ -1,15 +1,11 @@ set -e set -o pipefail -OUTFILE=/var/lib/nodeinfo.nix - +printenv BITCOIND_ONION=$(cat /var/lib/tor/onion/bitcoind/hostname) -CLIGHTNING_ID=$(sudo -u clightning lightning-cli getinfo | jq -r '.id') +CLIGHTNING_ID=$(sudo -u clightning lightning-cli --lightning-dir=/var/lib/clightning getinfo | jq -r '.id') -rm -f $OUTFILE -{ - echo \{ - echo " bitcoind_onion = \"$BITCOIND_ONION\";" - echo " clightning_id = \"$CLIGHTNING_ID\";" - echo \} -} > $OUTFILE +echo \{ +echo " bitcoind_onion = \"$BITCOIND_ONION\";" +echo " clightning_id = \"$CLIGHTNING_ID\";" +echo \}