nixos-rebuild: fix --use-remote-sudo

Currently fails with:

  $ nixos-rebuild test --target-host myhost --use-remote-sudo
  building Nix...
  sudo: /run/current-system/sw/bin/sudo must be owned by uid 0 and have the setuid bit set

It seems setting an explicit PATH in the ssh command overrides the
remote setuid wrappers.

(cherry picked from commit 35a8d78e44d566d6d2ddba42ae5137f7a511a090)
This commit is contained in:
rnhmjoj 2021-06-18 02:50:34 +02:00 committed by github-actions[bot]
parent e3c88e2a94
commit d81e14f491

View File

@ -145,7 +145,7 @@ buildHostCmd() {
if [ -z "$buildHost" ]; then
"$@"
elif [ -n "$remoteNix" ]; then
ssh $SSHOPTS "$buildHost" env PATH="$remoteNix":'$PATH' "${maybeSudo[@]}" "$@"
ssh $SSHOPTS "$buildHost" "${maybeSudo[@]}" env PATH="$remoteNix":'$PATH' "$@"
else
ssh $SSHOPTS "$buildHost" "${maybeSudo[@]}" "$@"
fi