Skip to content

Commit 5302e1b

Browse files
authored
Fix devx container failures: Bash 3.2 rejection and impure path errors (#226)
Two fixes for CI failures when consuming devx containers: 1. Use Nix-provided Bash in shebang instead of /usr/bin/env bash. On macOS GitHub Actions runners, /usr/bin/env bash resolves to Apple's Bash 3.2 (GPLv2), but nixpkgs' setup.sh requires Bash 5+. pkgs.bash is already in the closure via stdenv. 2. Disable NIX_ENFORCE_PURITY before sourcing stdenv/setup. The stdenv preHook defaults NIX_ENFORCE_PURITY to 1, causing cc-wrapper to reject -I/-L flags outside /nix/store/. This breaks cabal builds that use $HOME/.cabal-devx/store/. Setting it to empty before sourcing setup.sh matches nix develop behavior.
1 parent f7739c4 commit 5302e1b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

flake.nix

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@
342342
name = "devx";
343343
executable = true;
344344
text = ''
345-
#!/usr/bin/env bash
345+
#!${pkgs.bash}/bin/bash
346346
347347
# Raw derivation environment variables. These seed stdenv's
348348
# setup.sh with build inputs, compiler paths, and other
@@ -363,6 +363,14 @@
363363
mkdir -p "$out"
364364
fi
365365
366+
# Development shells must not enforce store-path purity.
367+
# The stdenv preHook defaults NIX_ENFORCE_PURITY to 1, which
368+
# causes the cc-wrapper to reject -I/-L flags pointing outside
369+
# /nix/store/ (e.g. the cabal package store at $CABAL_DIR/store/).
370+
# Setting it to empty before sourcing setup.sh makes the preHook's
371+
# ''${NIX_ENFORCE_PURITY-1} keep the empty value instead of defaulting.
372+
export NIX_ENFORCE_PURITY=
373+
366374
# Source stdenv's setup.sh to initialize the development
367375
# environment. This runs all setup hooks (cc-wrapper,
368376
# pkg-config-wrapper, etc.) and populates NIX_CFLAGS_COMPILE,

0 commit comments

Comments
 (0)