mirror of
https://github.com/simplex-chat/haskell.nix.git
synced 2026-06-03 09:17:32 +00:00
* Enables tests for Musl and AArch64 (also rasbery pi, but leaves them disabled for now) and includes many fixes for the tests that were broken. * Makes Musl cross compiler more like native (including making `ghci` and `runghc` work) * Updates selection of enableShared * Works around missing configFiles attribute issue * Use ghc-extra-packages and compiler.nix-name to pick the right extra packages * Leaves out --cross-compile on hsc2hs for musl * Fixes haddock and hoogle for musl and disables them for other cross compilers * Adds ghc 8.8.3 * Static link components (except libraries and `all`) on musl * Use qemu for the arm cross compile `testWrapper` * Add isCrossHost and isCrossTarget functions * Fixes profiling on AArch64 * Disable split sections when compiling for windows (fixes GHC 8.8 cross compile to windows) * Disable hoogle in cross compiler shells for now
91 lines
2.7 KiB
Nix
91 lines
2.7 KiB
Nix
{ stdenv, cabal-install, mkCabalProjectPkgSet, recurseIntoAttrs, runCommand }:
|
|
|
|
with stdenv.lib;
|
|
|
|
let
|
|
pkgSet = mkCabalProjectPkgSet {
|
|
plan-pkgs = import ./pkgs.nix;
|
|
pkg-def-extras = [{
|
|
pkga = ./.plan.nix/pkga.nix;
|
|
pkgb = ./.plan.nix/pkgb.nix;
|
|
}];
|
|
modules = [{
|
|
# Package has no exposed modules which causes
|
|
# haddock: No input file(s)
|
|
packages.bytestring-builder.doHaddock = false;
|
|
}];
|
|
};
|
|
|
|
env = pkgSet.config.hsPkgs.shellFor {
|
|
# Shell will provide the dependencies of pkga and pkgb, but not
|
|
# pkga and pkgb themselves.
|
|
packages = ps: with ps; [ pkga pkgb ];
|
|
# This adds cabal-install to the shell, which helps tests because
|
|
# they use a nix-shell --pure. Normally you would BYO cabal-install.
|
|
buildInputs = [ cabal-install ];
|
|
exactDeps = true;
|
|
};
|
|
|
|
envPkga = pkgSet.config.hsPkgs.shellFor {
|
|
# Shell will provide the dependencies of pkga
|
|
packages = ps: with ps; [ pkga ];
|
|
# This adds cabal-install to the shell, which helps tests because
|
|
# they use a nix-shell --pure. Normally you would BYO cabal-install.
|
|
buildInputs = [ cabal-install ];
|
|
exactDeps = true;
|
|
};
|
|
|
|
envDefault = pkgSet.config.hsPkgs.shellFor {
|
|
# The default implementation of packages should use isLocal and the
|
|
# result should be the same as:
|
|
# packages = ps: with ps; [ pkga pkgb ];
|
|
# This adds cabal-install to the shell, which helps tests because
|
|
# they use a nix-shell --pure. Normally you would BYO cabal-install.
|
|
buildInputs = [ cabal-install ];
|
|
};
|
|
|
|
in recurseIntoAttrs (if stdenv.hostPlatform.isWindows
|
|
then
|
|
let skip = runCommand "skip-test-shell-for" {} ''
|
|
echo "Skipping shell-for test on windows as does not work yet" >& 2
|
|
touch $out
|
|
'';
|
|
in {
|
|
env = skip;
|
|
envPkga = skip;
|
|
envDefault = skip;
|
|
run = skip;
|
|
}
|
|
else {
|
|
inherit env envPkga envDefault;
|
|
run = stdenv.mkDerivation {
|
|
name = "shell-for-test";
|
|
|
|
buildCommand = ''
|
|
########################################################################
|
|
# test shell-for with an example program
|
|
|
|
cp ${./pkgb/src}/*.hs .
|
|
|
|
printf "checking that the shell env has the dependencies...\n" >& 2
|
|
${env.ghc}/bin/${env.ghc.targetPrefix}runghc conduit-test.hs
|
|
|
|
printf "checking that the shell envDefault has the dependencies...\n" >& 2
|
|
${envDefault.ghc}/bin/${env.ghc.targetPrefix}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 env envPkga envDefault;
|
|
};
|
|
};
|
|
})
|