mirror of
https://github.com/ilyakooo0/haskell.nix.git
synced 2024-10-26 09:37:17 +03:00
Fix name of shellFor derivation for a single package. (#155)
This commit is contained in:
parent
bc01ebc05a
commit
3fb220334f
@ -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`,
|
||||
|
@ -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;
|
||||
};
|
||||
}
|
||||
|
1
test/shell-for/single.project
Normal file
1
test/shell-for/single.project
Normal file
@ -0,0 +1 @@
|
||||
packages: pkga
|
@ -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 \
|
||||
|
Loading…
Reference in New Issue
Block a user