haskellPackages: use static-enabled 'gmp' to enable statically linked Haskell binaries

Pass '-optl-static -optl-pthread' to GHC to enable static linking.

Fixes <https://github.com/NixOS/nixpkgs/issues/3193>. Further details can be
found at <http://permalink.gmane.org/gmane.linux.distributions.nixos/13526>.
This commit is contained in:
Vladimír Čunát 2014-07-06 13:37:46 +02:00 committed by Peter Simons
parent 38c2901741
commit 7c5a1b1d51
2 changed files with 13 additions and 7 deletions

View File

@ -1,8 +1,8 @@
{ stdenv, fetchurl, m4, cxx ? true }:
{ stdenv, fetchurl, m4, cxx ? true, withStatic ? false }:
with { inherit (stdenv.lib) optional; };
stdenv.mkDerivation rec {
stdenv.mkDerivation (rec {
name = "gmp-5.1.3";
src = fetchurl { # we need to use bz2, others aren't in bootstrapping stdenv
@ -27,10 +27,10 @@ stdenv.mkDerivation rec {
enableParallelBuilding = true;
meta = {
meta = with stdenv.lib; {
homepage = "http://gmplib.org/";
description = "GMP, the GNU multiple precision arithmetic library";
license = stdenv.lib.licenses.gpl3Plus;
license = licenses.gpl3Plus;
longDescription =
'' GMP is a free library for arbitrary precision arithmetic, operating
@ -54,7 +54,10 @@ stdenv.mkDerivation rec {
asymptotically faster algorithms.
'';
platforms = stdenv.lib.platforms.all;
maintainers = [ stdenv.lib.maintainers.simons ];
platforms = platforms.all;
maintainers = [ maintainers.simons ];
};
}
// stdenv.lib.optionalAttrs withStatic { dontDisableStatic = true; }
)

View File

@ -2933,7 +2933,10 @@ let
# Import Haskell infrastructure.
haskell = callPackage ./haskell-defaults.nix { inherit pkgs; };
haskell = let pkgs_ = pkgs // { gmp = gmp.override { withStatic = true; }; };
callPackage = newScope pkgs_;
newScope = extra: lib.callPackageWith (pkgs_ // pkgs_.xorg // extra);
in callPackage ./haskell-defaults.nix { pkgs = pkgs_; inherit callPackage newScope; };
# Available GHC versions.