haskell: add justStaticExecutables combinator

This commit is contained in:
Domen Kožar 2017-03-07 18:13:59 +01:00
parent e50203bfde
commit db23fe1581
No known key found for this signature in database
GPG Key ID: C2FFBCAFD2C24246

View File

@ -76,6 +76,14 @@ rec {
fixupPhase = ":";
});
# link executables statically against haskell libs to reduce closure size
justStaticExecutables = drv: overrideCabal drv (drv: {
enableSharedExecutables = false;
isLibrary = false;
doHaddock = false;
postFixup = "rm -rf $out/lib $out/nix-support $out/share/doc";
});
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"