about summary refs log tree commit diff
path: root/nixos/modules/services
diff options
context:
space:
mode:
authorBruno BELANYI <bruno@belanyi.fr>2024-03-22 20:48:15 +0000
committerBruno BELANYI <bruno@belanyi.fr>2024-03-22 20:54:36 +0000
commitaf6e25787827e25a87bb874362ad380a2cfab199 (patch)
tree7fd1bd92e6e05d93e51f7d208e2281fd80f761c8 /nixos/modules/services
parent6b1e9f77f96d2e01073c85f586200df47793cc28 (diff)
downloadnixlib-af6e25787827e25a87bb874362ad380a2cfab199.tar
nixlib-af6e25787827e25a87bb874362ad380a2cfab199.tar.gz
nixlib-af6e25787827e25a87bb874362ad380a2cfab199.tar.bz2
nixlib-af6e25787827e25a87bb874362ad380a2cfab199.tar.lz
nixlib-af6e25787827e25a87bb874362ad380a2cfab199.tar.xz
nixlib-af6e25787827e25a87bb874362ad380a2cfab199.tar.zst
nixlib-af6e25787827e25a87bb874362ad380a2cfab199.zip
nixos/tandoor-recipes: improve manage script
This is shamelessly stolen from Photoprism's module, and should allow
executing the manage script without resorting to various tricks due to
relying on transient users.
Diffstat (limited to 'nixos/modules/services')
-rw-r--r--nixos/modules/services/misc/tandoor-recipes.nix5
1 files changed, 4 insertions, 1 deletions
diff --git a/nixos/modules/services/misc/tandoor-recipes.nix b/nixos/modules/services/misc/tandoor-recipes.nix
index 1bdd7be406b9..1b1fde78ad0a 100644
--- a/nixos/modules/services/misc/tandoor-recipes.nix
+++ b/nixos/modules/services/misc/tandoor-recipes.nix
@@ -20,7 +20,10 @@ let
   manage = pkgs.writeShellScript "manage" ''
     set -o allexport # Export the following env vars
     ${lib.toShellVars env}
-    exec ${pkg}/bin/tandoor-recipes "$@"
+    eval "$(${config.systemd.package}/bin/systemctl show -pUID,GID,MainPID tandoor-recipes.service)"
+    exec ${pkgs.util-linux}/bin/nsenter \
+      -t $MainPID -m -S $UID -G $GID \
+      ${pkg}/bin/tandoor-recipes "$@"
   '';
 in
 {