From bb40443e7790d568058be9b8cd4a8e667b520f34 Mon Sep 17 00:00:00 2001 From: Pablo Andres Dealbera Date: Mon, 29 Jan 2024 13:26:35 -0300 Subject: [PATCH] nixos/photoprism: use nsenter to call photoprism bin with correct UID and PID --- nixos/modules/services/web-apps/photoprism.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nixos/modules/services/web-apps/photoprism.nix b/nixos/modules/services/web-apps/photoprism.nix index e25b03484424..1716840e84e5 100644 --- a/nixos/modules/services/web-apps/photoprism.nix +++ b/nixos/modules/services/web-apps/photoprism.nix @@ -18,6 +18,9 @@ let in pkgs.writeShellScript "manage" '' ${setupEnv} + eval "$(${config.systemd.package}/bin/systemctl show -pUID,MainPID photoprism.service | ${pkgs.gnused}/bin/sed "s/UID/ServiceUID/")" + exec ${pkgs.util-linux}/bin/nsenter \ + -t $MainPID -m -S $ServiceUID -G $ServiceUID --wdns=${cfg.storagePath} \ exec ${cfg.package}/bin/photoprism "$@" ''; in