From e12c4f0d8ea229210580cabb9ae06f8c9ebd6f31 Mon Sep 17 00:00:00 2001 From: Serhii Khoma Date: Wed, 25 Dec 2019 22:12:33 +0200 Subject: [PATCH 1/2] 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 --- src/Stack/Nix.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Stack/Nix.hs b/src/Stack/Nix.hs index 7e23c7ffaa..dce95d3512 100644 --- a/src/Stack/Nix.hs +++ b/src/Stack/Nix.hs @@ -95,7 +95,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 From 826ea1afece543cc2144bf5993a23a12d74775bd Mon Sep 17 00:00:00 2001 From: Serhii Khoma Date: Tue, 4 Feb 2020 20:52:39 +0200 Subject: [PATCH 2/2] fix(#5008): "Invalid option --internal-re-exec-version" error when using "nix" with options "enable: true", "pure: true", "shell-file: .." -> dont set inNixShellEnvVar second time if shell.nix is not used --- src/Stack/Nix.hs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Stack/Nix.hs b/src/Stack/Nix.hs index dce95d3512..9f61ed62bc 100644 --- a/src/Stack/Nix.hs +++ b/src/Stack/Nix.hs @@ -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