nixos/hedgedoc: Do not set StateDirectory to an absolute path

Commit 8109d8a set the `StateDirectory=` option of the systemd service
configuration to the value of `cfg.workDir` which is wrong, according
to dasJ [1]. This commit resolves this issue by stripping the
`/var/lib/` prefix from `cfg.workDir`.

[1] https://github.com/NixOS/nixpkgs/pull/172824#issuecomment-1130350412

(cherry picked from commit becff58579)
This commit is contained in:
M. A
2022-06-13 15:33:12 +00:00
committed by github-actions[bot]
parent 21321a6381
commit 4bab5cf047

View File

@@ -1023,7 +1023,8 @@ in
'';
serviceConfig = {
WorkingDirectory = cfg.workDir;
StateDirectory = [ cfg.workDir cfg.configuration.uploadsPath ];
StateDirectory = [ (builtins.replaceStrings [ "/var/lib/" ] [ "" ] cfg.workDir) ];
ReadWritePaths = [ cfg.configuration.uploadsPath ];
ExecStart = "${cfg.package}/bin/hedgedoc";
EnvironmentFile = mkIf (cfg.environmentFile != null) [ cfg.environmentFile ];
Environment = [