-
Notifications
You must be signed in to change notification settings - Fork 200
/
Copy pathmkGhcCompiler.nix
61 lines (52 loc) · 1.99 KB
/
mkGhcCompiler.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
{ pkgs
, ihp
, ghcCompiler
, dontCheckPackages ? []
, doJailbreakPackages ? []
, dontHaddockPackages ? []
, manualOverrides ? _: _: { }
, haskellPackagesDir ? ./haskell-packages
, filter
, ... }:
let
composeExtensionsList = pkgs.lib.fold pkgs.lib.composeExtensions (_: _: { });
generatedOverrides = haskellPackagesNew: haskellPackagesOld:
let
toPackage = dir: file: _: {
name = builtins.replaceStrings [ ".nix" ] [ "" ] file;
value = haskellPackagesNew.callPackage ("${dir}/${file}") { };
};
makePackageSet = dir: pkgs.lib.mapAttrs' (toPackage dir) (builtins.readDir dir);
in {
"ihp" = ((haskellPackagesNew.callPackage "${toString ihp}/ihp.nix") { inherit filter; });
} // (makePackageSet haskellPackagesDir) // (makePackageSet "${ihp}/NixSupport/haskell-packages/.");
makeOverrides =
function: names: haskellPackagesNew: haskellPackagesOld:
let
toPackage = name: {
inherit name;
value = function haskellPackagesOld.${name};
};
in
builtins.listToAttrs (map toPackage names);
ihpDontCheckPackages = [];
ihpDoJailbreakPackages = ["microlens-th"];
ihpDontHaddockPackages = [];
in ghcCompiler.override {
ghc = if pkgs.stdenv.isDarwin
then ghcCompiler.ghc.overrideAttrs (oldAttrs: { patches = [ ./ghc-12264.patch ./scav-bco.patch ] ++ (oldAttrs.patches or []); })
else ghcCompiler.ghc;
overrides = composeExtensionsList [
generatedOverrides
# Overrides provided by IHP
(makeOverrides pkgs.haskell.lib.dontCheck ihpDontCheckPackages)
(makeOverrides pkgs.haskell.lib.doJailbreak ihpDoJailbreakPackages)
(makeOverrides pkgs.haskell.lib.dontHaddock ihpDontHaddockPackages)
# Project specific overrides
(makeOverrides pkgs.haskell.lib.dontCheck dontCheckPackages )
(makeOverrides pkgs.haskell.lib.doJailbreak doJailbreakPackages)
(makeOverrides pkgs.haskell.lib.dontHaddock dontHaddockPackages)
manualOverrides
(self: super: { websockets = super.websockets_0_13_0_0; })
];
}