1- { stdenv , lib , haskellLib , cabal-install , mkCabalProjectPkgSet , recurseIntoAttrs , runCommand , testSrc , compiler-nix-name , evalPackages } :
1+ { stdenv , lib , haskellLib , recurseIntoAttrs , testSrc , compiler-nix-name , evalPackages } :
22
33with lib ;
44
55let
6- pkgSet = mkCabalProjectPkgSet {
7- plan-pkgs = import ./pkgs.nix ;
8- pkg-def-extras = [ {
9- pkga = ./.plan.nix/pkga.nix ;
10- pkgb = ./.plan.nix/pkgb.nix ;
11- } ] ;
12- modules = [ {
13- inherit evalPackages ;
14- } ] ;
6+ project = project' {
7+ inherit compiler-nix-name evalPackages ;
8+ src = testSrc "shell-for" ;
9+ cabalProjectLocal = builtins . readFile ../cabal.project.local ;
10+ modules = [ { inherit evalPackages ; } ] ;
1511 } ;
1612
17- env = pkgSet . config . hsPkgs . shellFor {
18- # Shell will provide the dependencies of pkga and pkgb, but not
19- # pkga and pkgb themselves.
13+ packages = project . hsPkgs ;
14+
15+ env = project . shellFor {
2016 packages = ps : with ps ; [ pkga pkgb ] ;
21- # This adds cabal-install to the shell, which helps tests because
22- # they use a nix-shell --pure. Normally you would BYO cabal-install.
2317 tools = {
2418 cabal . cabalProjectLocal = builtins . readFile ../cabal.project.local ;
2519 } ;
2620 exactDeps = true ;
27- # Avoid duplicate package issues when runghc looks for packages
2821 packageSetupDeps = false ;
2922 } ;
3023
31- envPkga = pkgSet . config . hsPkgs . shellFor {
24+ envPkga = project . shellFor {
3225 # Shell will provide the dependencies of pkga
3326 packages = ps : with ps ; [ pkga ] ;
3427 # This adds cabal-install to the shell, which helps tests because
4134 packageSetupDeps = false ;
4235 } ;
4336
44- envDefault = pkgSet . config . hsPkgs . shellFor {
37+ envDefault = project . shellFor {
4538 # The default implementation of packages should use isLocal and the
4639 # result should be the same as:
4740 # packages = ps: with ps; [ pkga pkgb ];
5750in recurseIntoAttrs {
5851 # Does not work on ghcjs because it needs zlib.
5952 # Does not work on windows because it needs mintty.
60- meta . disabled = stdenv . hostPlatform . isMusl || stdenv . hostPlatform . isGhcjs || stdenv . hostPlatform . isWindows || ( haskellLib . isCrossHost && stdenv . hostPlatform . isAarch64 )
61- || compiler-nix-name != ( ( import ./pkgs.nix ) . pkgs null ) . compiler . nix-name ;
53+ meta . disabled = stdenv . hostPlatform . isMusl
54+ || stdenv . hostPlatform . isGhcjs
55+ || stdenv . hostPlatform . isWindows
56+ || ( haskellLib . isCrossHost && stdenv . hostPlatform . isAarch64 ) ;
6257 inherit env envPkga envDefault ;
6358 run = stdenv . mkDerivation {
6459 name = "shell-for-test" ;
@@ -67,7 +62,7 @@ in recurseIntoAttrs {
6762 ########################################################################
6863 # test shell-for with an example program
6964
70- cp ${ . /pkgb/src} /*.hs .
65+ cp ${ testSrc "shell-for" + " /pkgb/src" } /*.hs .
7166
7267 printf "checking that the shell env has the dependencies...\n" >& 2
7368 ${ env . ghc } /bin/${ env . ghc . targetPrefix } runghc conduit-test.hs
@@ -83,8 +78,7 @@ in recurseIntoAttrs {
8378 } ;
8479
8580 passthru = {
86- # Used for debugging with nix repl
87- inherit pkgSet ;
81+ inherit project packages ;
8882
8983 # Used for testing externally with nix-shell (../tests.sh).
9084 inherit env envPkga envDefault ;
0 commit comments