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.
This commit is contained in:
Bruno BELANYI 2024-03-22 20:48:15 +00:00
parent 6b1e9f77f9
commit af6e257878
1 changed files with 4 additions and 1 deletions

View File

@ -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
{