runInLinuxVM: load stdenv/setup with fixed environment in stage2Init

In [1] we started sourcing stdenv/setup in stage2Init to allow for
structuredAttrs. We failed to take the changed NIX_BUILD_TOP etc.
variables into account. We need to load stdenv/setup after changing
them, because the structuredAttrs startup code makes use of it.

[1]: 97ed6b4565
This commit is contained in:
Wolfgang Walther
2024-11-30 13:40:26 +01:00
parent 9f6b99e1ef
commit 437e6dbbb0
+1 -1
View File
@@ -169,7 +169,6 @@ rec {
if [ -f "''${NIX_ATTRS_SH_FILE-}" ]; then
source "$NIX_ATTRS_SH_FILE"
fi
source $stdenv/setup
export NIX_STORE=${storeDir}
export NIX_BUILD_TOP=/tmp
@@ -177,6 +176,7 @@ rec {
export PATH=/empty
cd "$NIX_BUILD_TOP"
source $stdenv/setup
if ! test -e /bin/sh; then
${coreutils}/bin/mkdir -p /bin
${coreutils}/bin/ln -s ${bash}/bin/sh /bin/sh