diff --git a/pkgs/development/haskell-modules/lib.nix b/pkgs/development/haskell-modules/lib.nix index ab817b7b2a1..2093ec2b218 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 47e9b4213a8..6b01b111f23 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 {