mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-23 15:33:13 +00:00
nixos/healthchecks: automatically invoke sudo in the wrapper
much like nextcloud-occ does
This commit is contained in:
parent
a3c39df9e8
commit
897044e435
@ -15,14 +15,14 @@ let
|
||||
|
||||
environmentFile = pkgs.writeText "healthchecks-environment" (lib.generators.toKeyValue { } environment);
|
||||
|
||||
healthchecksManageScript = with pkgs; (writeShellScriptBin "healthchecks-manage" ''
|
||||
healthchecksManageScript = pkgs.writeShellScriptBin "healthchecks-manage" ''
|
||||
sudo=exec
|
||||
if [[ "$USER" != "${cfg.user}" ]]; then
|
||||
echo "please run as user 'healtchecks'." >/dev/stderr
|
||||
exit 1
|
||||
sudo='exec /run/wrappers/bin/sudo -u ${cfg.user} --preserve-env --preserve-env=PYTHONPATH'
|
||||
fi
|
||||
export $(cat ${environmentFile} | xargs);
|
||||
exec ${pkg}/opt/healthchecks/manage.py "$@"
|
||||
'');
|
||||
export $(cat ${environmentFile} | xargs)
|
||||
$sudo ${pkg}/opt/healthchecks/manage.py "$@"
|
||||
'';
|
||||
in
|
||||
{
|
||||
options.services.healthchecks = {
|
||||
|
Loading…
Reference in New Issue
Block a user