nixos/clamav: use state and runtime directory

This commit is contained in:
happysalada
2023-11-22 03:08:30 +00:00
committed by Yt
parent 026a91af5a
commit ef6b8ff15a
+4 -9
View File
@@ -107,14 +107,11 @@ in
wantedBy = [ "multi-user.target" ];
restartTriggers = [ clamdConfigFile ];
preStart = ''
mkdir -m 0755 -p ${runDir}
chown ${clamavUser}:${clamavGroup} ${runDir}
'';
serviceConfig = {
ExecStart = "${pkg}/bin/clamd";
ExecReload = "${pkgs.coreutils}/bin/kill -USR2 $MAINPID";
StateDirectory = "clamav";
RuntimeDirectory = "clamav";
PrivateTmp = "yes";
PrivateDevices = "yes";
PrivateNetwork = "yes";
@@ -134,15 +131,13 @@ in
description = "ClamAV virus database updater (freshclam)";
restartTriggers = [ freshclamConfigFile ];
after = [ "network-online.target" ];
preStart = ''
mkdir -m 0755 -p ${stateDir}
chown ${clamavUser}:${clamavGroup} ${stateDir}
'';
serviceConfig = {
Type = "oneshot";
ExecStart = "${pkg}/bin/freshclam";
SuccessExitStatus = "1"; # if databases are up to date
StateDirectory = "clamav";
RuntimeDirectory = "clamav";
PrivateTmp = "yes";
PrivateDevices = "yes";
};