1
- { stdenv , lib , haskellLib , cabal-install , mkCabalProjectPkgSet , recurseIntoAttrs , runCommand , testSrc , compiler-nix-name , evalPackages } :
1
+ { stdenv , lib , haskellLib , recurseIntoAttrs , testSrc , compiler-nix-name , evalPackages } :
2
2
3
3
with lib ;
4
4
5
5
let
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 ; } ] ;
15
11
} ;
16
12
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 {
20
16
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.
23
17
tools = {
24
18
cabal . cabalProjectLocal = builtins . readFile ../cabal.project.local ;
25
19
} ;
26
20
exactDeps = true ;
27
- # Avoid duplicate package issues when runghc looks for packages
28
21
packageSetupDeps = false ;
29
22
} ;
30
23
31
- envPkga = pkgSet . config . hsPkgs . shellFor {
24
+ envPkga = project . shellFor {
32
25
# Shell will provide the dependencies of pkga
33
26
packages = ps : with ps ; [ pkga ] ;
34
27
# This adds cabal-install to the shell, which helps tests because
41
34
packageSetupDeps = false ;
42
35
} ;
43
36
44
- envDefault = pkgSet . config . hsPkgs . shellFor {
37
+ envDefault = project . shellFor {
45
38
# The default implementation of packages should use isLocal and the
46
39
# result should be the same as:
47
40
# packages = ps: with ps; [ pkga pkgb ];
57
50
in recurseIntoAttrs {
58
51
# Does not work on ghcjs because it needs zlib.
59
52
# 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 ) ;
62
57
inherit env envPkga envDefault ;
63
58
run = stdenv . mkDerivation {
64
59
name = "shell-for-test" ;
@@ -67,7 +62,7 @@ in recurseIntoAttrs {
67
62
########################################################################
68
63
# test shell-for with an example program
69
64
70
- cp ${ . /pkgb/src} /*.hs .
65
+ cp ${ testSrc "shell-for" + " /pkgb/src" } /*.hs .
71
66
72
67
printf "checking that the shell env has the dependencies...\n" >& 2
73
68
${ env . ghc } /bin/${ env . ghc . targetPrefix } runghc conduit-test.hs
@@ -83,8 +78,7 @@ in recurseIntoAttrs {
83
78
} ;
84
79
85
80
passthru = {
86
- # Used for debugging with nix repl
87
- inherit pkgSet ;
81
+ inherit project packages ;
88
82
89
83
# Used for testing externally with nix-shell (../tests.sh).
90
84
inherit env envPkga envDefault ;
0 commit comments