onion-chef: set RemainAfterExit, fix tor dependency

This better fits the semantics of this unit and allows for easier
automated testing whether the service is active.

wantedBy = bindsTo = after = tor.service is the simplest way to ensure
that this unit is always running/restarted in lockstep with tor.
Previously, onion-chef would have stayed inactive in the case
that tor was stopped and then later restarted.
This commit is contained in:
Erik Arvstedt 2019-11-27 14:04:37 +01:00
parent 2b9b3ba1c5
commit 60c732a6a1
No known key found for this signature in database
GPG Key ID: 33312B944DD97846

View File

@ -70,14 +70,13 @@ in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
systemd.services.onion-chef = { systemd.services.onion-chef = {
description = "Run onion-chef"; description = "Run onion-chef";
wantedBy = [ "multi-user.target" ]; wantedBy = [ "tor.service" ];
requires = [ "tor.service" ]; bindsTo = [ "tor.service" ];
partOf = [ "tor.service" ];
after = [ "tor.service" ]; after = [ "tor.service" ];
serviceConfig = { serviceConfig = {
ExecStart = "${pkgs.bash}/bin/bash ${onion-chef-script}"; ExecStart = "${pkgs.bash}/bin/bash ${onion-chef-script}";
User = "root";
Type = "oneshot"; Type = "oneshot";
RemainAfterExit = true;
} // nix-bitcoin-services.defaultHardening; } // nix-bitcoin-services.defaultHardening;
}; };
}; };