1{ pkgs, stdenv, ghc
2, compilerConfig ? (self: super: {})
3, packageSetConfig ? (self: super: {})
4, overrides ? (self: super: {})
5}:
6
7let
8
9 inherit (stdenv.lib) fix' extends;
10
11 haskellPackages = self:
12 let
13
14 mkDerivation = pkgs.callPackage ./generic-builder.nix {
15 inherit stdenv;
16 inherit (pkgs) fetchurl pkgconfig glibcLocales coreutils gnugrep gnused;
17 inherit (self) ghc jailbreak-cabal;
18 hscolour = overrideCabal self.hscolour (drv: {
19 isLibrary = false;
20 doHaddock = false;
21 hyperlinkSource = false; # Avoid depending on hscolour for this build.
22 postFixup = "rm -rf $out/lib $out/share $out/nix-support";
23 });
24 cpphs = overrideCabal (self.cpphs.overrideScope (self: super: {
25 mkDerivation = drv: super.mkDerivation (drv // {
26 enableSharedExecutables = false;
27 enableSharedLibraries = false;
28 doHaddock = false;
29 useCpphs = false;
30 });
31 })) (drv: {
32 isLibrary = false;
33 postFixup = "rm -rf $out/lib $out/share $out/nix-support";
34 });
35 };
36
37 overrideCabal = drv: f: drv.override (args: args // {
38 mkDerivation = drv: args.mkDerivation (drv // f drv);
39 });
40
41 callPackageWithScope = scope: drv: args: (stdenv.lib.callPackageWith scope drv args) // {
42 overrideScope = f: callPackageWithScope (mkScope (fix' (extends f scope.__unfix__))) drv args;
43 };
44
45 mkScope = scope: pkgs // pkgs.xorg // pkgs.gnome // scope;
46 defaultScope = mkScope self;
47 callPackage = drv: args: callPackageWithScope defaultScope drv args;
48
49 withPackages = packages: callPackage ./with-packages-wrapper.nix {
50 inherit (self) llvmPackages;
51 haskellPackages = self;
52 inherit packages;
53 };
54
55 in
56 import ./hackage-packages.nix { inherit pkgs stdenv callPackage; } self // {
57
58 inherit mkDerivation callPackage;
59
60 ghcWithPackages = selectFrom: withPackages (selectFrom self);
61
62 ghcWithHoogle = selectFrom:
63 let
64 packages = selectFrom self;
65 hoogle = callPackage ./hoogle.nix { inherit packages; };
66 in withPackages (packages ++ [ hoogle ]);
67
68 ghc = ghc // {
69 withPackages = self.ghcWithPackages;
70 withHoogle = self.ghcWithHoogle;
71 };
72
73 };
74
75 commonConfiguration = import ./configuration-common.nix { inherit pkgs; };
76
77in
78
79 fix'
80 (extends overrides
81 (extends packageSetConfig
82 (extends compilerConfig
83 (extends commonConfiguration haskellPackages))))