on iko/ghcjs-patch-master help sign in
Fix name of shellFor derivation for a single package. (#155)
3fb2203Jean-Baptiste Giraudeau
builder/shell-for.nix+1−1
@@ -7,7 +7,7 @@ let
7 selectedConfigs = map (p: p.components.all.config) selected;
7 selectedConfigs = map (p: p.components.all.config) selected;
8
8
9 name = if lib.length selected == 1
9 name = if lib.length selected == 1
10− then "ghc-shell-for-${(lib.head selected).name}"
10+ then "ghc-shell-for-${(lib.head selected).identifier.name}"
11 else "ghc-shell-for-packages";
11 else "ghc-shell-for-packages";
12
12
13 # If `packages = [ a b ]` and `a` depends on `b`, don't build `b`,
13 # If `packages = [ a b ]` and `a` depends on `b`, don't build `b`,
test/shell-for/default.nix+9−1
@@ -25,6 +25,14 @@ let
25 buildInputs = [ cabal-install ];
25 buildInputs = [ cabal-install ];
26 };
26 };
27
27
28+ envPkga = pkgSet.config.hsPkgs.shellFor {
29+ # Shell will provide the dependencies of pkga
30+ packages = ps: with ps; [ pkga ];
31+ # This adds cabal-install to the shell, which helps tests because
32+ # they use a nix-shell --pure. Normally you would BYO cabal-install.
33+ buildInputs = [ cabal-install ];
34+ };
35+
28in
36in
29 stdenv.mkDerivation {
37 stdenv.mkDerivation {
30 name = "shell-for-test";
38 name = "shell-for-test";
@@ -47,6 +55,6 @@ in
47 inherit pkgSet;
55 inherit pkgSet;
48
56
49 # Used for testing externally with nix-shell (../tests.sh).
57 # Used for testing externally with nix-shell (../tests.sh).
50− inherit env;
58+ inherit env envPkga;
51 };
59 };
52}
60}
test/shell-for/single.projectnew file+1
@@ -0,0 +1 @@
1+packages: pkga
test/tests.sh+8−1
@@ -54,13 +54,20 @@ nix-shell $NIX_BUILD_ARGS \
54 --run 'cd cabal-simple && cabal new-build'
54 --run 'cd cabal-simple && cabal new-build'
55echo >& 2
55echo >& 2
56
56
57−printf "*** Checking shellFor works for a cabal project...\n" >& 2
57+printf "*** Checking shellFor works for a cabal project, multiple packages...\n" >& 2
58nix-shell $NIX_BUILD_ARGS \
58nix-shell $NIX_BUILD_ARGS \
59 --pure ./default.nix \
59 --pure ./default.nix \
60 -A shell-for.env \
60 -A shell-for.env \
61 --run 'cd shell-for && cabal new-build all'
61 --run 'cd shell-for && cabal new-build all'
62echo >& 2
62echo >& 2
63
63
64+printf "*** Checking shellFor works for a cabal project, single package...\n" >& 2
65+nix-shell $NIX_BUILD_ARGS \
66+ --pure ./default.nix \
67+ -A shell-for.envPkga \
68+ --run 'cd shell-for && cabal new-build --project=single.project all'
69+echo >& 2
70+
64printf "*** Checking shellFor has a working hoogle index...\n" >& 2
71printf "*** Checking shellFor has a working hoogle index...\n" >& 2
65nix-shell $NIX_BUILD_ARGS \
72nix-shell $NIX_BUILD_ARGS \
66 --pure ./default.nix \
73 --pure ./default.nix \