From d4ca4e449e82106afa3da378ac2d2d80b9e8ff11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Sun, 6 Jul 2014 13:37:46 +0200 Subject: [PATCH 1/2] haskellPackages: add ghcForStatic It's built with gmp that contains static libraries as well, so one is able to build statically linked haskell programs. --- pkgs/development/libraries/gmp/5.1.x.nix | 15 +++++++++------ pkgs/top-level/haskell-packages.nix | 6 ++++++ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/pkgs/development/libraries/gmp/5.1.x.nix b/pkgs/development/libraries/gmp/5.1.x.nix index cba8d394c2baf5..9e28334804bd62 100644 --- a/pkgs/development/libraries/gmp/5.1.x.nix +++ b/pkgs/development/libraries/gmp/5.1.x.nix @@ -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; } +) + diff --git a/pkgs/top-level/haskell-packages.nix b/pkgs/top-level/haskell-packages.nix index 166e81c46dd91f..f2d6ed14f11646 100644 --- a/pkgs/top-level/haskell-packages.nix +++ b/pkgs/top-level/haskell-packages.nix @@ -78,6 +78,12 @@ self : let callPackage = x : y : modifyPrio (newScope self x y); in ghc = ghc; # refers to ghcPlain }; + # capable of creating static executables by adding -optl-static -optl-pthread + # see thread http://permalink.gmane.org/gmane.linux.distributions.nixos/13526 + ghcForStatic = self.ghc.override { + ghc = ghc.override { gmp = pkgs.gmp.override { withStatic = true; }; }; + }; + # An experimental wrapper around ghcPlain that does not automatically # pick up packages from the profile, but instead has a fixed set of packages # in its global database. The set of packages can be specified as an From ea54d063ac86527c5f38738ec8c3a3eb58e632b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Mon, 7 Jul 2014 12:39:29 +0200 Subject: [PATCH 2/2] haskellPackages: use static-enabled gmp by default --- pkgs/top-level/all-packages.nix | 8 +++++++- pkgs/top-level/haskell-packages.nix | 6 ------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index fbbfa940abb2bc..e588898a53c104 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -2918,7 +2918,13 @@ let # Import Haskell infrastructure. - haskell = callPackage ./haskell-defaults.nix { inherit pkgs; }; + haskell = callPackage ./haskell-defaults.nix { + pkgs = pkgs // { + # allow creating static executables by adding -optl-static -optl-pthread + # see thread http://permalink.gmane.org/gmane.linux.distributions.nixos/13526 + gmp = gmp.override { withStatic = true; }; + }; + }; # Available GHC versions. diff --git a/pkgs/top-level/haskell-packages.nix b/pkgs/top-level/haskell-packages.nix index f2d6ed14f11646..166e81c46dd91f 100644 --- a/pkgs/top-level/haskell-packages.nix +++ b/pkgs/top-level/haskell-packages.nix @@ -78,12 +78,6 @@ self : let callPackage = x : y : modifyPrio (newScope self x y); in ghc = ghc; # refers to ghcPlain }; - # capable of creating static executables by adding -optl-static -optl-pthread - # see thread http://permalink.gmane.org/gmane.linux.distributions.nixos/13526 - ghcForStatic = self.ghc.override { - ghc = ghc.override { gmp = pkgs.gmp.override { withStatic = true; }; }; - }; - # An experimental wrapper around ghcPlain that does not automatically # pick up packages from the profile, but instead has a fixed set of packages # in its global database. The set of packages can be specified as an