3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #86194 from Profpatsch/pandoc-remove-ghc-from-runtime-closure

pandoc: remove GHC from the runtime closure (2.4GB -> 180MB)
This commit is contained in:
Jörg Thalheim 2020-04-28 14:56:41 +01:00
commit 839c0c783f
No known key found for this signature in database
GPG key ID: 003F2096411B5F92
2 changed files with 30 additions and 4 deletions

View file

@ -0,0 +1,29 @@
{ haskellPackages, haskell, removeReferencesTo }:
let
static = haskell.lib.justStaticExecutables haskellPackages.pandoc;
in
(haskell.lib.overrideCabal static (drv: {
configureFlags = drv.configureFlags or [] ++ ["-fembed_data_files"];
buildDepends = drv.buildDepends or [] ++ [haskellPackages.file-embed];
buildTools = (drv.buildTools or []) ++ [ removeReferencesTo ];
})).overrideAttrs (drv: {
# These libraries are still referenced, because pandoc references
# their `Paths_*` module for figuring out their version.
# The `Paths_*` module is generated by Cabal, and contains the
# version, but also paths to e.g. the data directories, which
# lead to a transitive runtime dependency on the whole GHC distribution.
# This should ideally be fixed in haskellPackages (or even Cabal),
# but a minimal pandoc is important enough to patch it manually.
disallowedReferences = [ haskellPackages.pandoc-types haskellPackages.HTTP ];
postInstall = ''
remove-references-to \
-t ${haskellPackages.pandoc-types} \
$out/bin/pandoc
remove-references-to \
-t ${haskellPackages.HTTP} \
$out/bin/pandoc
'';
})

View file

@ -5752,10 +5752,7 @@ in
pal = callPackage ../tools/misc/pal { };
pandoc = haskell.lib.overrideCabal (haskell.lib.justStaticExecutables haskellPackages.pandoc) (drv: {
configureFlags = drv.configureFlags or [] ++ ["-fembed_data_files"];
buildDepends = drv.buildDepends or [] ++ [haskellPackages.file-embed];
});
pandoc = callPackage ../development/tools/pandoc { };
pamtester = callPackage ../tools/security/pamtester { };