2015-01-10 19:26:08 +00:00
|
|
|
{ pkgs }:
|
|
|
|
|
|
|
|
rec {
|
2015-01-07 19:31:32 +00:00
|
|
|
|
2015-01-12 17:20:42 +00:00
|
|
|
overrideCabal = drv: f: (drv.override (args: args // {
|
2015-01-07 19:31:32 +00:00
|
|
|
mkDerivation = drv: args.mkDerivation (drv // f drv);
|
2015-01-12 17:20:42 +00:00
|
|
|
})) // {
|
2015-01-12 17:18:46 +00:00
|
|
|
overrideScope = scope: overrideCabal (drv.overrideScope scope) f;
|
2015-01-12 17:20:42 +00:00
|
|
|
};
|
2015-01-07 19:31:32 +00:00
|
|
|
|
2015-01-18 10:04:38 +00:00
|
|
|
doHaddock = drv: overrideCabal drv (drv: { doHaddock = true; });
|
|
|
|
dontHaddock = drv: overrideCabal drv (drv: { doHaddock = false; });
|
2015-01-10 19:26:08 +00:00
|
|
|
|
|
|
|
doJailbreak = drv: overrideCabal drv (drv: { jailbreak = true; });
|
|
|
|
dontJailbreak = drv: overrideCabal drv (drv: { jailbreak = false; });
|
|
|
|
|
2015-01-12 00:28:15 +00:00
|
|
|
doCheck = drv: overrideCabal drv (drv: { doCheck = true; });
|
2015-01-10 19:26:08 +00:00
|
|
|
dontCheck = drv: overrideCabal drv (drv: { doCheck = false; });
|
|
|
|
|
2015-09-15 14:02:39 +01:00
|
|
|
doDistribute = drv: overrideCabal drv (drv: { hydraPlatforms = drv.platforms or ["i686-linux" "x86_64-linux" "x86_64-darwin"]; });
|
2015-01-10 19:26:08 +00:00
|
|
|
dontDistribute = drv: overrideCabal drv (drv: { hydraPlatforms = []; });
|
|
|
|
|
2015-01-12 00:28:15 +00:00
|
|
|
appendConfigureFlag = drv: x: overrideCabal drv (drv: { configureFlags = (drv.configureFlags or []) ++ [x]; });
|
2015-01-10 19:26:08 +00:00
|
|
|
removeConfigureFlag = drv: x: overrideCabal drv (drv: { configureFlags = pkgs.stdenv.lib.remove x (drv.configureFlags or []); });
|
|
|
|
|
2015-01-19 13:59:04 +00:00
|
|
|
addBuildTool = drv: x: addBuildTools drv [x];
|
|
|
|
addBuildTools = drv: xs: overrideCabal drv (drv: { buildTools = (drv.buildTools or []) ++ xs; });
|
|
|
|
|
2015-02-03 11:24:13 +00:00
|
|
|
addExtraLibrary = drv: x: addExtraLibraries drv [x];
|
|
|
|
addExtraLibraries = drv: xs: overrideCabal drv (drv: { extraLibraries = (drv.extraLibraries or []) ++ xs; });
|
|
|
|
|
2015-01-20 22:50:38 +00:00
|
|
|
addBuildDepend = drv: x: addBuildDepends drv [x];
|
|
|
|
addBuildDepends = drv: xs: overrideCabal drv (drv: { buildDepends = (drv.buildDepends or []) ++ xs; });
|
|
|
|
|
2015-08-06 11:37:46 +01:00
|
|
|
addPkgconfigDepend = drv: x: addPkgconfigDepends drv [x];
|
2015-12-16 20:49:33 +00:00
|
|
|
addPkgconfigDepends = drv: xs: overrideCabal drv (drv: { pkgconfigDepends = (drv.pkgconfigDepends or []) ++ xs; });
|
2015-08-06 11:37:46 +01:00
|
|
|
|
2015-01-10 19:26:08 +00:00
|
|
|
enableCabalFlag = drv: x: appendConfigureFlag (removeConfigureFlag drv "-f-${x}") "-f${x}";
|
|
|
|
disableCabalFlag = drv: x: appendConfigureFlag (removeConfigureFlag drv "-f${x}") "-f-${x}";
|
|
|
|
|
2015-01-23 09:47:55 +00:00
|
|
|
markBroken = drv: overrideCabal drv (drv: { broken = true; });
|
|
|
|
markBrokenVersion = version: drv: assert drv.version == version; markBroken drv;
|
2015-01-12 15:12:33 +00:00
|
|
|
|
2015-01-13 11:28:17 +00:00
|
|
|
enableLibraryProfiling = drv: overrideCabal drv (drv: { enableLibraryProfiling = true; });
|
|
|
|
disableLibraryProfiling = drv: overrideCabal drv (drv: { enableLibraryProfiling = false; });
|
|
|
|
|
2015-02-06 11:10:56 +00:00
|
|
|
enableSharedExecutables = drv: overrideCabal drv (drv: { enableSharedExecutables = true; });
|
|
|
|
disableSharedExecutables = drv: overrideCabal drv (drv: { enableSharedExecutables = false; });
|
2015-01-13 11:28:17 +00:00
|
|
|
|
|
|
|
enableSharedLibraries = drv: overrideCabal drv (drv: { enableSharedLibraries = true; });
|
|
|
|
disableSharedLibraries = drv: overrideCabal drv (drv: { enableSharedLibraries = false; });
|
|
|
|
|
|
|
|
enableSplitObjs = drv: overrideCabal drv (drv: { enableSplitObjs = true; });
|
|
|
|
disableSplitObjs = drv: overrideCabal drv (drv: { enableSplitObjs = false; });
|
|
|
|
|
|
|
|
enableStaticLibraries = drv: overrideCabal drv (drv: { enableStaticLibraries = true; });
|
|
|
|
disableStaticLibraries = drv: overrideCabal drv (drv: { enableStaticLibraries = false; });
|
|
|
|
|
2015-01-23 09:47:55 +00:00
|
|
|
appendPatch = drv: x: appendPatches drv [x];
|
|
|
|
appendPatches = drv: xs: overrideCabal drv (drv: { patches = (drv.patches or []) ++ xs; });
|
|
|
|
|
2015-04-01 15:42:52 +01:00
|
|
|
doHyperlinkSource = drv: overrideCabal drv (drv: { hyperlinkSource = true; });
|
|
|
|
dontHyperlinkSource = drv: overrideCabal drv (drv: { hyperlinkSource = false; });
|
|
|
|
|
2015-06-02 12:58:57 +01:00
|
|
|
sdistTarball = pkg: pkgs.lib.overrideDerivation pkg (drv: {
|
|
|
|
name = "${drv.pname}-source-${drv.version}";
|
|
|
|
buildPhase = "./Setup sdist";
|
|
|
|
haddockPhase = ":";
|
|
|
|
checkPhase = ":";
|
2015-08-30 14:18:15 +01:00
|
|
|
installPhase = "install -D dist/${drv.pname}-*.tar.gz $out/${drv.pname}-${drv.version}.tar.gz";
|
2015-06-02 12:58:57 +01:00
|
|
|
fixupPhase = ":";
|
|
|
|
});
|
|
|
|
|
|
|
|
buildFromSdist = pkg: pkgs.lib.overrideDerivation pkg (drv: {
|
|
|
|
unpackPhase = let src = sdistTarball pkg; tarname = "${pkg.pname}-${pkg.version}"; in ''
|
|
|
|
echo "Source tarball is at ${src}/${tarname}.tar.gz"
|
|
|
|
tar xf ${src}/${tarname}.tar.gz
|
2015-08-30 14:18:15 +01:00
|
|
|
cd ${pkg.pname}-*
|
2015-06-02 12:58:57 +01:00
|
|
|
'';
|
|
|
|
});
|
|
|
|
|
|
|
|
buildStrictly = pkg: buildFromSdist (appendConfigureFlag pkg "--ghc-option=-Wall --ghc-option=-Werror");
|
|
|
|
|
2016-03-06 09:35:25 +00:00
|
|
|
buildStackProject = pkgs.callPackage ./generic-stack-builder.nix { };
|
2016-03-04 20:24:42 +00:00
|
|
|
|
2015-06-06 23:05:17 +01:00
|
|
|
triggerRebuild = drv: i: overrideCabal drv (drv: { postUnpack = ": trigger rebuild ${toString i}"; });
|
|
|
|
|
2015-01-07 19:31:32 +00:00
|
|
|
}
|