nixos/jenkins: set StateDirectory if home is /var/lib/jenkins

This will cause systemd to chown /var/lib/jenkins to the user that
the jenkins systemd service runs as, fixing permission issues when
mounting /var/lib/jenkins from another data volume.

It uses the same logic that garage is using, too, checking for the
prefix.
This commit is contained in:
Florian Klink 2023-12-07 15:02:34 +02:00
parent 23ff652157
commit 70808d0217

View File

@ -236,6 +236,7 @@ in {
serviceConfig = {
User = cfg.user;
StateDirectory = mkIf (hasPrefix "/var/lib/jenkins" cfg.home) "jenkins";
};
};
};