|
| 1 | +# Test a package set |
| 2 | +{ stdenv, util, cabalProject', haskellLib, gmp6, zlib, recurseIntoAttrs }: |
| 3 | + |
| 4 | +with stdenv.lib; |
| 5 | + |
| 6 | +let |
| 7 | + project = |
| 8 | + cabalProject' { |
| 9 | + src = haskellLib.cleanGit { src = ../..; subDir = "test/cabal-doctests"; }; |
| 10 | + index-state = "2020-01-26T00:00:00Z"; |
| 11 | + modules = [ |
| 12 | + { |
| 13 | + # This is needed for the doctest library to be built. Without it, you |
| 14 | + # get an error like the following: |
| 15 | + # |
| 16 | + # Configuring library for doctest-0.16.2.. |
| 17 | + # Error: |
| 18 | + # The following packages are broken because other packages they |
| 19 | + # depend on are missing. These broken packages must be rebuilt |
| 20 | + # before they can be used. |
| 21 | + # - installed package ghc-8.6.5 is broken due to missing package |
| 22 | + # terminfo-0.4.1.2 |
| 23 | + nonReinstallablePkgs = |
| 24 | + [ "rts" "ghc-heap" "ghc-prim" "integer-gmp" "integer-simple" "base" |
| 25 | + "deepseq" "array" "ghc-boot-th" "pretty" "template-haskell" |
| 26 | + "ghc-boot" |
| 27 | + "ghc" "Cabal" "Win32" "array" "binary" "bytestring" "containers" |
| 28 | + "directory" "filepath" "ghc-boot" "ghc-compact" "ghc-prim" |
| 29 | + "ghci" "haskeline" |
| 30 | + "hpc" |
| 31 | + "mtl" "parsec" "process" "text" "time" "transformers" |
| 32 | + "unix" "xhtml" |
| 33 | + "stm" "terminfo" |
| 34 | + ]; |
| 35 | + |
| 36 | + packages.cabal-doctests-test.components.tests.doctests.isDoctest = true; |
| 37 | + } |
| 38 | + ]; |
| 39 | + }; |
| 40 | + |
| 41 | + packages = project.hsPkgs; |
| 42 | + |
| 43 | +in |
| 44 | + |
| 45 | +recurseIntoAttrs { |
| 46 | + ifdInputs = { |
| 47 | + inherit (project) plan-nix; |
| 48 | + }; |
| 49 | + |
| 50 | + # Used for testing externally with nix-shell (../tests.sh). |
| 51 | + # This just adds cabal-install to the existing shells. |
| 52 | + # test-shell = util.addCabalInstall packages.cabal-doctests-test.components.all; |
| 53 | + |
| 54 | + run = stdenv.mkDerivation { |
| 55 | + name = "cabal-doctests-test"; |
| 56 | + |
| 57 | + buildCommand = '' |
| 58 | + printf "Checking that doctest tests have run ... " >& 2 |
| 59 | + doctest_output="${packages.cabal-doctests-test.checks.doctests}" |
| 60 | + test -f "$doctest_output" |
| 61 | + cat "$doctest_output" >& 2 |
| 62 | +
|
| 63 | + touch $out |
| 64 | + ''; |
| 65 | + |
| 66 | + meta.platforms = platforms.all; |
| 67 | + |
| 68 | + passthru = { |
| 69 | + # Used for debugging with nix repl |
| 70 | + inherit project packages; |
| 71 | + }; |
| 72 | + }; |
| 73 | +} |
0 commit comments