about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorPablo Andres Dealbera <dealberapablo07@gmail.com>2024-01-29 13:26:35 -0300
committergithub-actions[bot] <github-actions[bot]@users.noreply.github.com>2024-01-31 19:52:41 +0000
commit1841a32db8508a3325a021eebed4b2c6838082e6 (patch)
treeaac872a11574b163ef37700454b8bedd887959d0 /nixos
parentc9c08df33312756fb3acc118163438ddaf95eed1 (diff)
nixos/photoprism: use nsenter to call photoprism bin with correct UID and PID
(cherry picked from commit bb40443e7790d568058be9b8cd4a8e667b520f34)
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/web-apps/photoprism.nix3
1 files changed, 3 insertions, 0 deletions
diff --git a/nixos/modules/services/web-apps/photoprism.nix b/nixos/modules/services/web-apps/photoprism.nix
index 423ad5375baab..1a0ce6c078da1 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