summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Simons <simons@cryp.to>2017-03-08 08:49:19 +0100
committerGitHub <noreply@github.com>2017-03-08 08:49:19 +0100
commit722b12965290a55a758cbf7aee587682edd5e5af (patch)
treec80d5b5e5223efed2072900960e7be8691b5ef66
parent22c265182f9e0d543de0fe46a809180ff2021b85 (diff)
parentf67a89e2484bd0c58d3860276264adb65939aaa5 (diff)
downloadnixlib-722b12965290a55a758cbf7aee587682edd5e5af.tar
nixlib-722b12965290a55a758cbf7aee587682edd5e5af.tar.gz
nixlib-722b12965290a55a758cbf7aee587682edd5e5af.tar.bz2
nixlib-722b12965290a55a758cbf7aee587682edd5e5af.tar.lz
nixlib-722b12965290a55a758cbf7aee587682edd5e5af.tar.xz
nixlib-722b12965290a55a758cbf7aee587682edd5e5af.tar.zst
nixlib-722b12965290a55a758cbf7aee587682edd5e5af.zip
Merge pull request #23607 from NixOS/haskell/justStaticExecutables
Haskell/just static executables
-rw-r--r--pkgs/development/haskell-modules/lib.nix8
-rw-r--r--pkgs/top-level/all-packages.nix30
2 files changed, 14 insertions, 24 deletions
diff --git a/pkgs/development/haskell-modules/lib.nix b/pkgs/development/haskell-modules/lib.nix
index ab817b7b2a16..2093ec2b218b 100644
--- a/pkgs/development/haskell-modules/lib.nix
+++ b/pkgs/development/haskell-modules/lib.nix
@@ -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"
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 47e9b4213a8a..6b01b111f230 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -3289,14 +3289,9 @@ with pkgs;
 
   pal = callPackage ../tools/misc/pal { };
 
-  pandoc = haskell.lib.overrideCabal haskellPackages.pandoc (drv: {
+  pandoc = haskell.lib.overrideCabal (haskell.lib.justStaticExecutables haskellPackages.pandoc) (drv: {
     configureFlags = drv.configureFlags or [] ++ ["-fembed_data_files"];
     buildTools = drv.buildTools or [] ++ [haskellPackages.hsb2hs];
-    enableSharedExecutables = false;
-    enableSharedLibraries = false;
-    isLibrary = false;
-    doHaddock = false;
-    postFixup = "rm -rf $out/lib $out/nix-support $out/share";
   });
 
   panomatic = callPackage ../tools/graphics/panomatic { };
@@ -5134,15 +5129,12 @@ with pkgs;
 
   cabal-install = haskell.lib.disableSharedExecutables haskellPackages.cabal-install;
 
-  stack = haskell.lib.overrideCabal haskellPackages.stack (drv: {
-    enableSharedExecutables = false;
-    isLibrary = false;
-    doHaddock = false;
-    postFixup = "rm -rf $out/lib $out/nix-support $out/share/doc";
-  });
+  stack = haskell.lib.justStaticExecutables haskellPackages.stack;
 
   all-cabal-hashes = callPackage ../data/misc/hackage/default.nix { };
 
+  purescript = haskell.lib.justStaticExecutables haskellPackages.purescript;
+
   inherit (ocamlPackages) haxe;
 
   hxcpp = callPackage ../development/compilers/haxe/hxcpp.nix { };
@@ -6758,12 +6750,7 @@ with pkgs;
 
   shards = callPackage ../development/tools/build-managers/shards { };
 
-  shellcheck = haskell.lib.overrideCabal haskellPackages.ShellCheck (drv: {
-    isLibrary = false;
-    enableSharedExecutables = false;
-    doHaddock = false;
-    postFixup = "rm -rf $out/lib $out/nix-support $out/share/doc";
-  });
+  shellcheck = haskell.lib.justStaticExecutables haskellPackages.ShellCheck;
 
   shncpd = callPackage ../tools/networking/shncpd { };
 
@@ -13027,13 +13014,8 @@ with pkgs;
 
   cyclone = callPackage ../applications/audio/pd-plugins/cyclone  { };
 
-  darcs = haskell.lib.overrideCabal haskellPackages.darcs (drv: {
+  darcs = haskell.lib.overrideCabal (haskell.lib.justStaticExecutables haskellPackages.darcs) (drv: {
     configureFlags = (stdenv.lib.remove "-flibrary" drv.configureFlags or []) ++ ["-f-library"];
-    enableSharedExecutables = false;
-    enableSharedLibraries = false;
-    isLibrary = false;
-    doHaddock = false;
-    postFixup = "rm -rf $out/lib $out/nix-support $out/share";
   });
 
   darktable = callPackage ../applications/graphics/darktable {