tests.haskell.shellFor: change package used in extraDependencies test

This commit does the following two things:

1. Changes the Haskell package used in the extraDependencies test from
releaser to conduit. The reason for this is that conduit is more
of a "core" package in Haskell, and it is more likely to always be
working. (If conduit is not compiling, then large chunks of Hackage
won't be working.)

2. Tighten up the GHCi test to actually use the package from
extraDependencies. It appears that GHCi can fail to import the
package from extraDependencies, and that doesn't cause GHCi to
return an error code, which means the test isn't actually testing
anything.

This new change makes it so that if the package from
extraDependencies is actually not included for some reason, then
this shellFor test should fail.

+16 -6
+16 -6
pkgs/test/haskell/shellFor/default.nix
··· 2 3 (haskellPackages.shellFor { 4 packages = p: [ p.constraints p.linear ]; 5 - extraDependencies = p: { libraryHaskellDepends = [ p.releaser ]; }; 6 nativeBuildInputs = [ cabal-install ]; 7 phases = [ "unpackPhase" "buildPhase" "installPhase" ]; 8 unpackPhase = '' ··· 18 mkdir -p $HOME/.cabal 19 touch $HOME/.cabal/config 20 21 - # Check extraDependencies.libraryHaskellDepends arg 22 ghci <<EOF 23 - :m + Releaser.Primitives 24 - :m + System.IO 25 - writeFile "done" "done" 26 EOF 27 - [[ done == $(cat done) ]] 28 29 # Check packages arg 30 cabal v2-build --offline --verbose constraints linear --ghc-options="-O0 -j$NIX_BUILD_CORES"
··· 2 3 (haskellPackages.shellFor { 4 packages = p: [ p.constraints p.linear ]; 5 + # WARNING: When updating this, make sure that the libraries passed to 6 + # `extraDependencies` are not actually transitive dependencies of libraries in 7 + # `packages` above. We explicitly want to test that it is possible to specify 8 + # `extraDependencies` that are not in the closure of `packages`. 9 + extraDependencies = p: { libraryHaskellDepends = [ p.conduit ]; }; 10 nativeBuildInputs = [ cabal-install ]; 11 phases = [ "unpackPhase" "buildPhase" "installPhase" ]; 12 unpackPhase = '' ··· 22 mkdir -p $HOME/.cabal 23 touch $HOME/.cabal/config 24 25 + # Check that the extraDependencies.libraryHaskellDepends arg is correctly 26 + # picked up. This uses ghci to interpret a small Haskell program that uses 27 + # a package from extraDependencies. 28 ghci <<EOF 29 + :set -XOverloadedStrings 30 + :m + Conduit 31 + runResourceT $ connect (yield "done") (sinkFile "outfile") 32 EOF 33 + 34 + if [[ "done" != "$(cat outfile)" ]]; then 35 + echo "ERROR: extraDependencies appear not to be available in the environment" 36 + exit 1 37 + fi 38 39 # Check packages arg 40 cabal v2-build --offline --verbose constraints linear --ghc-options="-O0 -j$NIX_BUILD_CORES"