Merge pull request #298168 from ambroisie/improve-tandoor-recipes-manage

nixos/tandoor-recipes: improve manage script
This commit is contained in:
Felix Bühler 2024-03-24 17:06:01 +01:00 committed by GitHub
commit 63078e3468
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 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
{
@ -82,6 +85,7 @@ in
Restart = "on-failure";
User = "tandoor_recipes";
Group = "tandoor_recipes";
DynamicUser = true;
StateDirectory = "tandoor-recipes";
WorkingDirectory = "/var/lib/tandoor-recipes";