From becff585796094f75d0ccbe1df5418ef873897ac Mon Sep 17 00:00:00 2001 From: "M. A" Date: Mon, 13 Jun 2022 15:33:12 +0000 Subject: [PATCH] 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 --- nixos/modules/services/web-apps/hedgedoc.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nixos/modules/services/web-apps/hedgedoc.nix b/nixos/modules/services/web-apps/hedgedoc.nix index 22270609dbcc..0310c15a4d27 100644 --- a/nixos/modules/services/web-apps/hedgedoc.nix +++ b/nixos/modules/services/web-apps/hedgedoc.nix @@ -1031,7 +1031,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 = [