haskell.nix/test/shell-for-setup-deps/default.nix
Hamish Mackenzie 79c2c631c3
Run the cross compiled tests on wine (#317)
Changes to the haskell.nix code to fix broken tests:

* Add missing `then` to `call-cabal-project-to-nix.nix`.

* Fix default `hsSourceDirs` so that `.` gets included for `.all` component if one of the components does not have a `hsSourceDir` set.

* Fix `haskellNixRoots` so it works when cross compiling to windows.

Improvements to the haskell.nix tests:

* Run haskell.nix tests of nixpkgs 19.03 and 19.09.

* Run haskell.nix tests cross compiled to Windows under Wine (when possible).

* Add nix used as IFD inputs as tests to ensure they are cached.

* Use `haskell-nix.cabal-install` instead of `nixpkgs.cabal-install` in tests.
2019-11-20 13:47:15 +13:00

59 lines
1.4 KiB
Nix

{ stdenv, cabal-install, cabalProject', recurseIntoAttrs, runCommand }:
with stdenv.lib;
let
project = cabalProject' {
name = "test-shell-for-setup-deps";
src = ./.;
modules = [{
# Package has no exposed modules which causes
# haddock: No input file(s)
packages.bytestring-builder.doHaddock = false;
}];
};
env = project.hsPkgs.shellFor {};
in recurseIntoAttrs (if stdenv.hostPlatform.isWindows
then
let skip = runCommand "skipping-test-shell-for-setup-deps" {} ''
echo "Skipping shell-for-setup-deps test on windows as does not work yet" >& 2
touch $out
'';
in {
plan-nix = skip;
env = skip;
run = skip;
}
else {
inherit (project) plan-nix;
inherit env;
run = stdenv.mkDerivation {
name = "shell-for-test";
buildCommand = ''
########################################################################
# test shell-for with an example program
cp ${./pkg/src}/*.hs .
printf "checking that the shell env has the dependencies...\n" >& 2
${env.ghc}/bin/runghc conduit-test.hs
touch $out
'';
meta.platforms = platforms.all;
meta.disabled = stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWindows;
passthru = {
# Used for debugging with nix repl
inherit pkgSet;
# Used for testing externally with nix-shell (../tests.sh).
inherit project env;
};
};
})