nixos/cron: Fix ShellCheck issue in preStart script

Fixes the following warning when setting
`systemd.enableStrictShellChecks = true`:

> SC2174 (warning): When used with -p, -m only applies to the deepest
> directory.

Since it could conceivably be possible for `/var` to not exist when
running this script, the fix also explicitly tries to create /var with
the normal 0755 permissions.
This commit is contained in:
Victor Engmark 2025-01-04 14:00:21 +01:00
parent a1945f760a
commit 361c7f79b7
No known key found for this signature in database

View File

@ -125,7 +125,8 @@ in
wantedBy = [ "multi-user.target" ];
preStart = ''
mkdir -m 710 -p /var/cron
(umask 022 && mkdir -p /var)
(umask 067 && mkdir -p /var/cron)
# By default, allow all users to create a crontab. This
# is denoted by the existence of an empty cron.deny file.