Skip to content

Commit af478af

Browse files
committed
Fix devx wrapper: set $out for stdenv/setup outside Nix builds
stdenv's setup.sh calls _assignFirst which requires $out to be set for output variable assignment. Inside a Nix build the builder sets $out automatically, but when running the devx wrapper directly (containers, CI validation) $out is unset and setup.sh fails with: error: _assignFirst: could not find a non-empty variable whose name to assign to outputDev. Fix in two places: - mkEnvScript: wrapper sets $out to a temp dir when unset - pr-validate.yml: set $out before invoking cached wrappers that don't yet include the mkEnvScript fix
1 parent 07b1fae commit af478af

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

.github/workflows/pr-validate.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ jobs:
9999
echo "Cabal: $(cabal --version 2>/dev/null | head -1 || echo N/A)"
100100
TESTEOF
101101
102+
# stdenv's setup.sh requires $out for output variable assignment.
103+
# Inside a Nix build $out is set automatically; when running
104+
# directly we must provide a dummy value.
105+
export out=$(mktemp -d)
102106
"$DEVX_PATH" "$SMOKE_TEST"
103107
echo "::endgroup::"
104108

flake.nix

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,14 @@
349349
# attributes needed to initialize the full dev environment.
350350
${envExports}
351351
352+
# setup.sh requires $out for output variable assignment
353+
# (_assignFirst). Inside a Nix build $out is set by the
354+
# builder; when running directly (container, CLI) we
355+
# provide a temporary directory so setup.sh succeeds.
356+
if [ -z "''${out:-}" ]; then
357+
export out=$(mktemp -d)
358+
fi
359+
352360
# Source stdenv's setup.sh to initialize the development
353361
# environment. This runs all setup hooks (cc-wrapper,
354362
# pkg-config-wrapper, etc.) and populates NIX_CFLAGS_COMPILE,

0 commit comments

Comments
 (0)