3
0
Fork 0
forked from mirrors/nixpkgs

nixos-rebuild: use remote $PATH in buildHostCmd

this fixes the issue when using

    nixos-rebuild switch --target-host <target> --use-remote-sudo

when the local machine does not have anything in `$PATH` that would
resolve to `sudo` on the remote machine.

the single quotes prevent expansion of `$PATH` on the local machine,
such that the remote machine's value of that variable is used.
This commit is contained in:
fricklerhandwerk 2020-12-27 02:16:19 +01:00 committed by Cole Helbling
parent 707bb2712e
commit 283eaaff3e

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" env PATH="$remoteNix":'$PATH' "${maybeSudo[@]}" "$@"
else
ssh $SSHOPTS "$buildHost" "${maybeSudo[@]}" "$@"
fi