Skip to content

Commit 31e50c0

Browse files
committed
Set the EnvOverride properly when using the solver
1 parent 0fa24c2 commit 31e50c0

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/Stack/Solver.hs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ import qualified Data.Yaml as Yaml
4141
import qualified Distribution.Package as C
4242
import qualified Distribution.PackageDescription as C
4343
import qualified Distribution.Text as C
44+
import Lens.Micro (set)
4445
import Path
4546
import Path.Find (findFiles)
4647
import Path.IO hiding (findExecutable, findFiles, withSystemTempDir)
@@ -770,14 +771,20 @@ checkSnapBuildPlanActual
770771
-> SnapshotDef
771772
-> RIO env BuildPlanCheck
772773
checkSnapBuildPlanActual root gpds flags sd = do
773-
let forNonSnapshot = (Just . snd) <$> setupCabalEnv (sdWantedCompilerVersion sd)
774+
let forNonSnapshot = Just <$> setupCabalEnv (sdWantedCompilerVersion sd)
774775
mactualCompiler <-
775776
case sdResolver sd of
776777
ResolverSnapshot _ -> return Nothing
777778
ResolverCompiler _ -> forNonSnapshot
778779
ResolverCustom _ _ -> forNonSnapshot
779780

780-
checkSnapBuildPlan root gpds flags sd mactualCompiler
781+
let inner = checkSnapBuildPlan root gpds flags sd
782+
case mactualCompiler of
783+
Nothing -> inner Nothing
784+
Just (modifiedPath, actualCompiler) -> do
785+
env0 <- ask
786+
let env = set envOverrideL (const $ return modifiedPath) env0
787+
runRIO env $ inner (Just actualCompiler)
781788

782789
prettyPath
783790
:: forall r t m. (MonadIO m, RelPath (Path r t) ~ Path Rel t, AnyPath (Path r t))

0 commit comments

Comments
 (0)