@@ -128,10 +128,12 @@ in
128 ++ lib.attrValues (buildPackages.haskell-nix.tools compiler.nix-name tools)
128 ++ lib.attrValues (buildPackages.haskell-nix.tools compiler.nix-name tools)
129 # If this shell is a cross compilation shell include
129 # If this shell is a cross compilation shell include
130 # wrapper script for running cabal build with appropriate args.
130 # wrapper script for running cabal build with appropriate args.
131+ # Includes `--with-compiler` in case the `cabal.project` file has `with-compiler:` in it.
131 ++ lib.optional (ghcEnv.targetPrefix != "") (
132 ++ lib.optional (ghcEnv.targetPrefix != "") (
132 buildPackages.writeShellScriptBin "${ghcEnv.targetPrefix}cabal" ''
133 buildPackages.writeShellScriptBin "${ghcEnv.targetPrefix}cabal" ''
133 exec cabal \
134 exec cabal \
134 --with-ghc=${ghcEnv.targetPrefix}ghc \
135 --with-ghc=${ghcEnv.targetPrefix}ghc \
136+ --with-compiler=${ghcEnv.targetPrefix}ghc \
135 --with-ghc-pkg=${ghcEnv.targetPrefix}ghc-pkg \
137 --with-ghc-pkg=${ghcEnv.targetPrefix}ghc-pkg \
136 --with-hsc2hs=${ghcEnv.targetPrefix}hsc2hs \
138 --with-hsc2hs=${ghcEnv.targetPrefix}hsc2hs \
137 ${lib.optionalString (ghcEnv.targetPrefix == "js-unknown-ghcjs-") ''
139 ${lib.optionalString (ghcEnv.targetPrefix == "js-unknown-ghcjs-") ''