onionAddresses: use StateDirectory instead of tmpfiles

Simplifies the dataDir setup.
This commit is contained in:
Erik Arvstedt 2021-01-14 13:24:11 +01:00
parent 5c6977b006
commit 43c247e3fe
No known key found for this signature in database
GPG Key ID: 33312B944DD97846

View File

@ -68,10 +68,6 @@ in {
};
config = mkIf cfg.enable {
systemd.tmpfiles.rules = [
"d '${dataDir}' 0755 root root - -"
];
systemd.services.onion-addresses = {
description = "Run onion-addresses";
wantedBy = [ "tor.service" ];
@ -81,9 +77,9 @@ in {
ExecStart = "${pkgs.bash}/bin/bash ${onion-addresses-script}";
Type = "oneshot";
RemainAfterExit = true;
StateDirectory = "onion-addresses";
PrivateNetwork = "true"; # This service needs no network access
PrivateUsers = "false";
ReadWritePaths = "${dataDir}";
CapabilityBoundingSet = "CAP_CHOWN CAP_FSETID CAP_SETFCAP CAP_DAC_OVERRIDE CAP_DAC_READ_SEARCH CAP_FOWNER CAP_IPC_OWNER";
};
};