bitcoind: use systemd startup notification

This commit is contained in:
Erik Arvstedt 2021-01-30 10:47:08 +01:00
parent 332d0e70c8
commit b114d0c3b1
No known key found for this signature in database
GPG Key ID: 33312B944DD97846
1 changed files with 5 additions and 6 deletions

View File

@ -11,6 +11,8 @@ let
# We're already logging via journald
nodebuglogfile=1
startupnotify=/run/current-system/systemd/bin/systemd-notify --ready
${optionalString cfg.regtest ''
regtest=1
[regtest]
@ -346,15 +348,12 @@ in {
install -o '${cfg.user}' -g '${cfg.group}' -m 640 <(echo "$cfg") $confFile
fi
'';
postStart = ''
# Poll until bitcoind accepts commands. This can take a long time.
while ! ${cfg.cli}/bin/bitcoin-cli getnetworkinfo &> /dev/null; do
sleep 1
done
'';
serviceConfig = nix-bitcoin-services.defaultHardening // {
Type = "notify";
NotifyAccess = "all";
User = "${cfg.user}";
Group = "${cfg.group}";
TimeoutStartSec = 300;
ExecStart = "${cfg.package}/bin/bitcoind -datadir='${cfg.dataDir}'";
Restart = "on-failure";
UMask = mkIf cfg.dataDirReadableByGroup "0027";