Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(#5008): "Invalid option --internal-re-exec-version" error when using "nix" with options "enable: true", "pure: true", "shell-file: .." -> prevent entering "nix-shell --pure" recursively by exporting STACK_IN_NIX_SHELL properly #5131

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/Stack/Nix.hs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ runShellAndExit = do
,"runCommand ''myEnv'' { "
,"buildInputs = lib.optional stdenv.isLinux glibcLocales ++ inputs; "
,T.pack platformVariantEnvVar <> "=''nix''; "
,T.pack inNixShellEnvVar <> "=1; "
,if inContainer
-- If shell is pure, this env var would not
-- be seen by stack inside nix
Expand All @@ -95,7 +94,7 @@ runShellAndExit = do
F.</> "nix-gc-symlinks" F.</> "gc-root"] else []
,map T.unpack (nixShellOptions (configNix config))
,nixopts
,["--run", unwords (cmnd:"$STACK_IN_NIX_EXTRA_ARGS":args')]
,["--run", unwords ("export " <> inNixShellEnvVar <> "=1; ":cmnd:"$STACK_IN_NIX_EXTRA_ARGS":args')]
]
-- Using --run instead of --command so we cannot
-- end up in the nix-shell if stack build is Ctrl-C'd
Expand Down