@@ -0,0 +1,52 @@
1+{ stdenv, cabal-install, mkCabalProjectPkgSet }:
2+
3+with stdenv.lib;
4+
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+ # Package has no exposed modules which causes
14+ # haddock: No input file(s)
15+ packages.bytestring-builder.doHaddock = false;
16+ }];
17+ };
18+
19+ env = pkgSet.config.hsPkgs.shellFor {
20+ # Shell will provide the dependencies of pkga and pkgb, but not
21+ # pkga and pkgb themselves.
22+ packages = ps: with ps; [ pkga pkgb ];
23+ # This adds cabal-install to the shell, which helps tests because
24+ # they use a nix-shell --pure. Normally you would BYO cabal-install.
25+ buildInputs = [ cabal-install ];
26+ };
27+
28+in
29+ stdenv.mkDerivation {
30+ name = "shell-for-test";
31+
32+ buildCommand = ''
33+ ########################################################################
34+ # test shell-for with an example program
35+
36+ cp ${./pkgb/src}/*.hs .
37+
38+ printf "checking that the shell env has the dependencies...\n" >& 2
39+ ${env.ghc}/bin/runghc conduit.hs
40+
41+ touch $out
42+ '';
43+
44+ meta.platforms = platforms.all;
45+ passthru = {
46+ # Used for debugging with nix repl
47+ inherit pkgSet;
48+
49+ # Used for testing externally with nix-shell (../tests.sh).
50+ inherit env;
51+ };
52+}