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:
commit
839c0c783f
2 changed files with 30 additions and 4 deletions
29
pkgs/development/tools/pandoc/default.nix
Normal file
29
pkgs/development/tools/pandoc/default.nix
Normal 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
|
||||||
|
'';
|
||||||
|
})
|
|
@ -5752,10 +5752,7 @@ in
|
||||||
|
|
||||||
pal = callPackage ../tools/misc/pal { };
|
pal = callPackage ../tools/misc/pal { };
|
||||||
|
|
||||||
pandoc = haskell.lib.overrideCabal (haskell.lib.justStaticExecutables haskellPackages.pandoc) (drv: {
|
pandoc = callPackage ../development/tools/pandoc { };
|
||||||
configureFlags = drv.configureFlags or [] ++ ["-fembed_data_files"];
|
|
||||||
buildDepends = drv.buildDepends or [] ++ [haskellPackages.file-embed];
|
|
||||||
});
|
|
||||||
|
|
||||||
pamtester = callPackage ../tools/security/pamtester { };
|
pamtester = callPackage ../tools/security/pamtester { };
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue