Fix name of shellFor derivation for a single package. (#155)

This commit is contained in:
Jean-Baptiste Giraudeau 2019-05-30 22:46:39 +02:00 committed by GitHub
parent bc01ebc05a
commit 3fb220334f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 3 deletions

View File

@ -7,7 +7,7 @@ let
selectedConfigs = map (p: p.components.all.config) selected;
name = if lib.length selected == 1
then "ghc-shell-for-${(lib.head selected).name}"
then "ghc-shell-for-${(lib.head selected).identifier.name}"
else "ghc-shell-for-packages";
# If `packages = [ a b ]` and `a` depends on `b`, don't build `b`,

View File

@ -25,6 +25,14 @@ let
buildInputs = [ cabal-install ];
};
envPkga = pkgSet.config.hsPkgs.shellFor {
# Shell will provide the dependencies of pkga
packages = ps: with ps; [ pkga ];
# This adds cabal-install to the shell, which helps tests because
# they use a nix-shell --pure. Normally you would BYO cabal-install.
buildInputs = [ cabal-install ];
};
in
stdenv.mkDerivation {
name = "shell-for-test";
@ -47,6 +55,6 @@ in
inherit pkgSet;
# Used for testing externally with nix-shell (../tests.sh).
inherit env;
inherit env envPkga;
};
}

View File

@ -0,0 +1 @@
packages: pkga

View File

@ -54,13 +54,20 @@ nix-shell $NIX_BUILD_ARGS \
--run 'cd cabal-simple && cabal new-build'
echo >& 2
printf "*** Checking shellFor works for a cabal project...\n" >& 2
printf "*** Checking shellFor works for a cabal project, multiple packages...\n" >& 2
nix-shell $NIX_BUILD_ARGS \
--pure ./default.nix \
-A shell-for.env \
--run 'cd shell-for && cabal new-build all'
echo >& 2
printf "*** Checking shellFor works for a cabal project, single package...\n" >& 2
nix-shell $NIX_BUILD_ARGS \
--pure ./default.nix \
-A shell-for.envPkga \
--run 'cd shell-for && cabal new-build --project=single.project all'
echo >& 2
printf "*** Checking shellFor has a working hoogle index...\n" >& 2
nix-shell $NIX_BUILD_ARGS \
--pure ./default.nix \