2022-06-16 17:23:12 +00:00
|
|
|
{ stdenv, lib, haskellPackages, fetchpatch, haskell, removeReferencesTo }:
|
2020-05-15 21:57:56 +00:00
|
|
|
|
|
|
|
let
|
2021-12-06 16:07:01 +00:00
|
|
|
static = haskell.lib.compose.justStaticExecutables haskellPackages.pandoc;
|
2020-05-15 21:57:56 +00:00
|
|
|
|
|
|
|
in
|
2021-12-06 16:07:01 +00:00
|
|
|
(haskell.lib.compose.overrideCabal (drv: {
|
2020-05-15 21:57:56 +00:00
|
|
|
configureFlags = drv.configureFlags or [] ++ ["-fembed_data_files"];
|
|
|
|
buildDepends = drv.buildDepends or [] ++ [haskellPackages.file-embed];
|
|
|
|
buildTools = (drv.buildTools or []) ++ [ removeReferencesTo ];
|
|
|
|
|
2022-01-26 04:04:25 +00:00
|
|
|
postInstall = drv.postInstall or "" + ''
|
2020-05-15 21:57:56 +00:00
|
|
|
remove-references-to \
|
|
|
|
-t ${haskellPackages.pandoc-types} \
|
|
|
|
$out/bin/pandoc
|
2022-06-16 17:23:12 +00:00
|
|
|
'' + lib.optionalString (stdenv.buildPlatform == stdenv.hostPlatform) ''
|
|
|
|
mkdir -p $out/share/bash-completion/completions
|
|
|
|
$out/bin/pandoc --bash-completion > $out/share/bash-completion/completions/pandoc
|
2020-05-15 21:57:56 +00:00
|
|
|
'';
|
2022-04-03 18:54:34 +00:00
|
|
|
}) static).overrideAttrs (drv: {
|
|
|
|
# These libraries are still referenced, because they generate
|
|
|
|
# a `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.
|
2022-05-18 14:49:53 +00:00
|
|
|
disallowedReferences = [ haskellPackages.pandoc-types ];
|
2020-05-15 21:57:56 +00:00
|
|
|
})
|