mirror of
https://github.com/ilyakooo0/haskell.nix.git
synced 2024-09-11 06:55:40 +03:00
This adds a way to specify the `evalSystem` or `evalPackages` explicitly when calling the `project` functions. Currently if we want to make a `flake` that supports multiple systems we have few options: * Require builders for all the supported systems (even just for `nix flake show`). * Pass `--impure` so that haskell.nix can see `builtins.currentSystem` to set up `pkgs.evalPackages` to use that. Unfortunately this prevents nix from caching some of the work it does and often results in it recalculating for each supported system when it would otherwise be cached and take no time at all. * Add an overlay to replace `evalPackages`. This works, but it is not straight forward. * Materialize the nix files for the project. This change allows `evalSystem = "x86_64-linux";` to be passed telling `haskell.nix` to run `cabal` and `nix-tools` on that system. The user will have to have a builder for that system, but does not need to have builders for the others (unless building outputs for them).
45 lines
1.4 KiB
Nix
45 lines
1.4 KiB
Nix
{ stdenv, lib, haskellPackages, snapshots, recurseIntoAttrs, runCommand, testSrc, compiler-nix-name, evalPackages }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
env = snapshots."lts-14.13".ghcWithHoogle
|
|
(ps: with ps; [ conduit conduit-extra resourcet ]);
|
|
|
|
in recurseIntoAttrs {
|
|
# Does not work on ghcjs because it needs zlib.
|
|
meta.disabled = stdenv.hostPlatform.isGhcjs || compiler-nix-name != "ghc865";
|
|
inherit env;
|
|
run = stdenv.mkDerivation {
|
|
name = "shell-for-test";
|
|
|
|
buildCommand = ''
|
|
########################################################################
|
|
# test single component from haskellPackages
|
|
|
|
printf "checking that the latest LTS snapshot has the lens package...\n" >& 2
|
|
test -d ${haskellPackages.lens.components.library}
|
|
|
|
########################################################################
|
|
# test snapshot ghcWithHoogle
|
|
|
|
printf "checking that the ghcWithPackages env has the package...\n" >& 2
|
|
${env}/bin/${env.targetPrefix}ghc-pkg list | grep conduit
|
|
|
|
''
|
|
# Hoogle support is currently disabled in cross compiler shells
|
|
+ (optionalString (stdenv.buildPlatform == stdenv.hostPlatform) ''
|
|
printf "checking that the ghcWithPackages env has a hoogle index...\n" >& 2
|
|
${env}/bin/hoogle search Conduit --count=100 | grep ConduitT
|
|
'') +''
|
|
|
|
touch $out
|
|
'';
|
|
|
|
meta.platforms = platforms.all;
|
|
passthru = {
|
|
inherit env;
|
|
};
|
|
};
|
|
}
|