daml/nix/ghc.nix
Moritz Kiefer d455267e58
Reduce the number of GHCs in our nix closure (#4729)
This reduces the number of GHCs to 2 on Linux (regular and DWARF) and
1 on macOS. Given that each derivation is > 1 GB this should hopefully
help a bit.

changelog_begin
changelog_end
2020-02-26 20:00:07 +01:00

45 lines
1.5 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);
});
ghc = pkgs.callPackage ./overrides/ghc-8.6.5.nix rec {
bootPkgs = pkgs.haskell.packages.ghc863Binary;
inherit (pkgs.python3Packages) sphinx;
inherit (pkgs) buildLlvmPackages;
enableIntegerSimple = true;
enableShared = false;
enableRelocatedStaticLibs = true;
libffi = null;
};
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