2015-01-07 19:31:32 +00:00
|
|
|
{ pkgs, stdenv, ghc
|
|
|
|
, packageSetConfig ? (self: super: {})
|
|
|
|
, overrides ? (self: super: {})
|
|
|
|
, provideOldAttributeNames ? false
|
|
|
|
}:
|
|
|
|
|
|
|
|
with ./lib.nix;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
fix = f: let x = f x // { __unfix__ = f; }; in x;
|
|
|
|
|
|
|
|
extend = rattrs: f: self: let super = rattrs self; in super // f self super;
|
|
|
|
|
|
|
|
haskellPackages = self:
|
|
|
|
let
|
|
|
|
|
|
|
|
mkDerivation = pkgs.callPackage ./generic-builder.nix {
|
2015-01-10 11:50:43 +00:00
|
|
|
inherit stdenv;
|
2015-01-07 19:31:32 +00:00
|
|
|
inherit (pkgs) fetchurl pkgconfig glibcLocales coreutils gnugrep gnused;
|
2015-01-10 11:50:43 +00:00
|
|
|
inherit (self) ghc jailbreak-cabal;
|
2015-01-07 19:31:32 +00:00
|
|
|
hscolour = overrideCabal self.hscolour (drv: {
|
|
|
|
isLibrary = false;
|
2015-01-18 10:04:38 +00:00
|
|
|
doHaddock = false;
|
2015-01-07 19:31:32 +00:00
|
|
|
hyperlinkSource = false; # Avoid depending on hscolour for this build.
|
|
|
|
postFixup = "rm -rf $out/lib $out/share $out/nix-support";
|
|
|
|
});
|
2015-01-13 21:15:29 +00:00
|
|
|
cpphs = overrideCabal (self.cpphs.overrideScope (self: super: {
|
|
|
|
mkDerivation = drv: super.mkDerivation (drv // {
|
|
|
|
enableSharedExecutables = false;
|
|
|
|
enableSharedLibraries = false;
|
2015-01-18 10:04:38 +00:00
|
|
|
doHaddock = false;
|
2015-01-13 21:15:29 +00:00
|
|
|
useCpphs = false;
|
|
|
|
});
|
|
|
|
})) (drv: {
|
|
|
|
isLibrary = false;
|
|
|
|
postFixup = "rm -rf $out/lib $out/share $out/nix-support";
|
|
|
|
});
|
2015-01-07 19:31:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
overrideCabal = drv: f: drv.override (args: args // {
|
|
|
|
mkDerivation = drv: args.mkDerivation (drv // f drv);
|
|
|
|
});
|
|
|
|
|
2015-01-08 17:29:37 +00:00
|
|
|
callPackageWithScope = scope: drv: args: (stdenv.lib.callPackageWith scope drv args) // {
|
|
|
|
overrideScope = f: callPackageWithScope (fix (extend scope.__unfix__ f)) drv args;
|
|
|
|
};
|
|
|
|
|
2015-01-07 19:31:32 +00:00
|
|
|
defaultScope = pkgs // pkgs.xlibs // pkgs.gnome // self;
|
2015-01-08 17:29:37 +00:00
|
|
|
callPackage = drv: args: callPackageWithScope defaultScope drv args;
|
2015-01-07 19:31:32 +00:00
|
|
|
|
|
|
|
in
|
|
|
|
import ./hackage-packages.nix { inherit pkgs stdenv callPackage; } self // {
|
|
|
|
|
2015-01-10 11:50:43 +00:00
|
|
|
inherit mkDerivation callPackage;
|
2015-01-07 19:31:32 +00:00
|
|
|
|
|
|
|
ghcWithPackages = pkgs: callPackage ./with-packages-wrapper.nix { packages = pkgs self; };
|
|
|
|
|
2015-01-10 11:50:43 +00:00
|
|
|
ghc = ghc // { withPackages = self.ghcWithPackages; };
|
|
|
|
|
2015-01-07 19:31:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
compatLayer = if provideOldAttributeNames then import ./compat-layer.nix else (self: super: {});
|
|
|
|
commonConfiguration = import ./configuration-common.nix { inherit pkgs; };
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
fix (extend (extend (extend (extend haskellPackages commonConfiguration) packageSetConfig) overrides) compatLayer)
|