@@ -1,9 +1,11 @@
11{ pkgs
22, haskell
33, stdenv
4+, util
45}:
56
67with stdenv.lib;
8+with util;
79
810let
911 pkgSet = haskell.mkPkgSet {
@@ -34,22 +36,32 @@ let
3436
3537 packages = pkgSet.config.hsPkgs;
3638
37− # Add cabal as a buildInput for a haskell derivation. Useful for nix-shell.
38− addCabalInstall = drv: drv.overrideAttrs (oldAttrs: {
39− buildInputs = (oldAttrs.buildInputs or []) ++ [ pkgs.cabal-install ];
40− });
39+ package = packages.test-with-packages;
40+ inherit (package.components) library;
41+
42+ pkgId = p: "${p.identifier.name}-${p.identifier.version}";
43+ showDepends = component: concatMapStringsSep " " pkgId component.depends;
4144
4245in
4346 stdenv.mkDerivation {
4447 name = "with-packages-test";
48+ libraryDepends = showDepends pkgSet.config.packages.test-with-packages.components.library;
49+ allDepends = showDepends pkgSet.config.packages.test-with-packages.components.all;
4550
46− buildCommand = let
47− package = packages.test-with-packages;
48− inherit (package.components) library;
49− in ''
51+ buildCommand = ''
5052 ########################################################################
5153 # test with-packages
5254
55+ printf "checking merging of the 'all' component depends ... " >& 2
56+ if [ -n "$libraryDepends" -a "$libraryDepends" = "$allDepends" ]; then
57+ echo "PASS" >& 2
58+ else
59+ echo "FAIL" >& 2
60+ echo "libraryDepends = $libraryDepends"
61+ echo "allDepends = $allDepends"
62+ exit 1
63+ fi
64+
5365 printf "checking that the 'all' component works... " >& 2
5466 echo ${package.components.all} >& 2
5567
@@ -62,7 +74,7 @@ in
6274
6375 printf "checking that components.library.env has the dependencies... " >& 2
6476 ${library.env}/bin/runghc ${./Point.hs}
65− # echo >& 2
77+ echo >& 2
6678
6779 touch $out
6880 '';