daml/nix/ghc.nix
Andreas Herrmann a89cbb2036
Update rules_haskell (#1133)
* Update rules_haskell

- rules_haskell now handles the global package db within Bazel
    https://github.com/tweag/rules_haskell/pull/859
- We no longer use the Nix provided c2hs. So, we drop it.
- Rename `ghcWithC2hs` to `ghcStatic` to clarify that that's where the
    static linking patches are applied.
- Extend package-db patches to align Nix store paths with the new $out.
    This works around a restriction in current rules_haskell, where
    the paths in the package config files must have the same prefix as
    the path to the package config files themselves.
- Don't exclude haskell libraries from extra-libraries entries.

* Drop redundant unix-compat override

This is a left-over from when the package was patched.

* Windows GHC bindist includes ffi header

* Drop unused language-c Nix override
2019-05-20 14:20:34 +02:00

63 lines
2.3 KiB
Nix

# This file defines the GHC along with any overrides that is used for the
# nix builds and stack builds.
{ system ? builtins.currentSystem
, pkgs ? import ./nixpkgs.nix { inherit system; }
}:
let
hsLib = pkgs.haskell.lib;
hsOverrides = with pkgs.haskell.lib; with pkgs.lib; (self: super:
rec {
# Override the default mkDerivation.
# NOTE: Changing this in any way will cause a full rebuild of every package!
mkDerivation = args: super.mkDerivation (args // {
enableLibraryProfiling = args.enableLibraryProfiling or true;
doCheck = args.doCheck or false;
});
withPackages = packages: super.callPackage ./with-packages-wrapper.nix {
inherit (self) ghc llvmPackages;
inherit packages;
};
ghcWithPackages = selectFrom: withPackages (selectFrom self);
});
ghc863Binary = pkgs.callPackage ./overrides/ghc-8.6.3-binary.nix {
gcc-clang-wrapper = "${toString pkgs.path}/pkgs/development/compilers/ghc/gcc-clang-wrapper.sh";
};
ghc863BinaryPackages = pkgs.callPackage "${toString pkgs.path}/pkgs/development/haskell-modules" {
haskellLib = pkgs.haskell.lib;
buildHaskellPackages = ghc863BinaryPackages;
ghc = ghc863Binary;
compilerConfig = pkgs.callPackage "${toString pkgs.path}/pkgs/development/haskell-modules/configuration-ghc-8.6.x.nix" { haskellLib = pkgs.haskell.lib; };
packageSetConfig = self: super: {
mkDerivation = drv: super.mkDerivation (drv // {
doCheck = false;
doHaddock = false;
enableExecutableProfiling = false;
enableLibraryProfiling = false;
enableSharedExecutables = false;
enableSharedLibraries = false;
});
};
};
ghc = pkgs.callPackage ./overrides/ghc-8.6.5.nix rec {
bootPkgs = ghc863BinaryPackages;
inherit (pkgs.python3Packages) sphinx;
inherit (pkgs) buildLlvmPackages;
enableIntegerSimple = true;
enableRelocatedStaticLibs = true;
};
packages = pkgs.callPackage "${toString pkgs.path}/pkgs/development/haskell-modules" {
haskellLib = pkgs.haskell.lib;
inherit ghc;
buildHaskellPackages = packages;
compilerConfig = pkgs.callPackage "${toString pkgs.path}/pkgs/development/haskell-modules/configuration-ghc-8.6.x.nix" { haskellLib = pkgs.haskell.lib; };
overrides = hsOverrides;
};
in packages