on e94de40 help sign in
66 lines 2.0 kB history raw
1{ stdenv, cabal-install, cabalProject', recurseIntoAttrs, runCommand, testSrc, compiler-nix-name }:
3with stdenv.lib;
5let
6 project = cabalProject' {
7 inherit compiler-nix-name;
8 src = testSrc "shell-for-setup-deps";
9 modules = [{
10 # Package has no exposed modules which causes
11 # haddock: No input file(s)
12 packages.bytestring-builder.doHaddock = false;
13 }];
14 };
16 env = project.hsPkgs.shellFor {};
18# Making this work for cross compilers will be difficult as setup-deps are
19# built for the build platform and the shell will be for the host platform.
20# We probably need a shell that provides both build and host ghc
21# and corresponding package DBs and a way to use them.
22# This problem affects musl as well as the build libraries are linked to glibc.
23in recurseIntoAttrs (if stdenv.buildPlatform != stdenv.hostPlatform
24 then
25 let skip = runCommand "skipping-test-shell-for-setup-deps" {} ''
26 echo "Skipping shell-for-setup-deps test on cross compilers (does not work yet)" >& 2
27 touch $out
28 '';
29 in {
30 ifdInputs = { plan-nix = skip; };
31 env = skip;
32 run = skip;
33 }
34 else {
35 ifdInputs = {
36 inherit (project) plan-nix;
37 };
38 inherit env;
39 run = stdenv.mkDerivation {
40 name = "shell-for-setup-deps-test";
42 buildCommand = ''
43 ########################################################################
44 # test shell-for with an example program
46 cp ${./pkg/src}/*.hs .
48 printf "checking that the shell env has the dependencies...\n" >& 2
49 ${env.ghc}/bin/${env.ghc.targetPrefix}ghc-pkg list
50 ${env.ghc}/bin/${env.ghc.targetPrefix}runghc conduit-test.hs
52 touch $out
53 '';
55 meta.platforms = platforms.all;
56 meta.disabled = stdenv.buildPlatform != stdenv.hostPlatform;
58 passthru = {
59 # Used for debugging with nix repl
60 inherit pkgSet;
62 # Used for testing externally with nix-shell (../tests.sh).
63 inherit project env;
64 };
65 };
66})