runInLinuxVM: fix simple build

In 58570e75d9bddede2a854b0f7cb8df7f1818c541, I moved the PATH for
coreutils *before* the sourcing of attrs + stdenv. However, AFAICT, this
leads to PATH being overwritten and cat+chmod can't be found later on.

We don't need to set PATH here at all, we can just do the same thing as
in stage2Init - reference every coreutil explicitly. This keeps the
environment the cleanest.

Resolves #378545

Changed files
+4 -5
pkgs
build-support
+4 -5
pkgs/build-support/vm/default.nix
···
vmRunCommand = qemuCommand: writeText "vm-run" ''
${coreutils}/bin/mkdir xchg
export > xchg/saved-env
-
PATH=${coreutils}/bin
if [ -f "''${NIX_ATTRS_SH_FILE-}" ]; then
-
cp $NIX_ATTRS_JSON_FILE $NIX_ATTRS_SH_FILE xchg
+
${coreutils}/bin/cp $NIX_ATTRS_JSON_FILE $NIX_ATTRS_SH_FILE xchg
source "$NIX_ATTRS_SH_FILE"
fi
source $stdenv/setup
···
# Write the command to start the VM to a file so that the user can
# debug inside the VM if the build fails (when Nix is called with
# the -K option to preserve the temporary build directory).
-
cat > ./run-vm <<EOF
+
${coreutils}/bin/cat > ./run-vm <<EOF
#! ${bash}/bin/sh
''${diskImage:+diskImage=$diskImage}
# GitHub Actions runners seems to not allow installing seccomp filter: https://github.com/rcambrj/nix-pi-loader/issues/1#issuecomment-2605497516
···
${qemuCommand}
EOF
-
chmod +x ./run-vm
+
${coreutils}/bin/chmod +x ./run-vm
source ./run-vm
if ! test -e xchg/in-vm-exit; then
···
exit 1
fi
-
exitCode="$(cat xchg/in-vm-exit)"
+
exitCode="$(${coreutils}/bin/cat xchg/in-vm-exit)"
if [ "$exitCode" != "0" ]; then
exit "$exitCode"
fi