2024-06-06 10:49:13 +00:00
|
|
|
|
{ lib, stdenv, haskellPackages, haskell
|
2020-06-08 11:07:30 +00:00
|
|
|
|
# “Plugins” are a fancy way of saying gitit will invoke
|
|
|
|
|
# GHC at *runtime*, which in turn makes it pull GHC
|
|
|
|
|
# into its runtime closure. Only enable if you really need
|
|
|
|
|
# that feature. But if you do you’ll want to use gitit
|
|
|
|
|
# as a library anyway.
|
|
|
|
|
, pluginSupport ? false
|
|
|
|
|
}:
|
|
|
|
|
|
|
|
|
|
let
|
2024-06-06 09:57:50 +00:00
|
|
|
|
inherit (haskell.lib.compose)
|
|
|
|
|
enableCabalFlag
|
|
|
|
|
disableCabalFlag
|
|
|
|
|
justStaticExecutables
|
2024-06-06 10:49:13 +00:00
|
|
|
|
overrideCabal
|
2024-06-06 09:57:50 +00:00
|
|
|
|
;
|
2020-06-08 11:07:30 +00:00
|
|
|
|
|
2024-06-06 09:57:50 +00:00
|
|
|
|
base = (if pluginSupport then enableCabalFlag else disableCabalFlag)
|
|
|
|
|
"plugins"
|
|
|
|
|
haskellPackages.gitit;
|
2024-06-06 10:49:13 +00:00
|
|
|
|
|
|
|
|
|
# Removes erroneous references from dead code that GHC can't eliminate
|
|
|
|
|
aarch64DarwinFix = overrideCabal (drv:
|
|
|
|
|
lib.optionalAttrs (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) {
|
|
|
|
|
postInstall = ''
|
|
|
|
|
${drv.postInstall or ""}
|
|
|
|
|
remove-references-to -t ${haskellPackages.HTTP} "$out/bin/gitit"
|
|
|
|
|
remove-references-to -t ${haskellPackages.HTTP} "$out/bin/expireGititCache"
|
|
|
|
|
remove-references-to -t ${haskellPackages.happstack-server} "$out/bin/gitit"
|
|
|
|
|
remove-references-to -t ${haskellPackages.hoauth2} "$out/bin/gitit"
|
|
|
|
|
remove-references-to -t ${haskellPackages.pandoc} "$out/bin/gitit"
|
|
|
|
|
remove-references-to -t ${haskellPackages.pandoc-types} "$out/bin/gitit"
|
|
|
|
|
'';
|
|
|
|
|
});
|
2020-06-08 11:07:30 +00:00
|
|
|
|
in
|
2024-06-06 09:52:07 +00:00
|
|
|
|
|
2024-06-06 09:57:50 +00:00
|
|
|
|
if pluginSupport
|
|
|
|
|
then base
|
2024-06-06 10:49:13 +00:00
|
|
|
|
else lib.pipe (base.override { ghc-paths = null; }) [
|
|
|
|
|
justStaticExecutables
|
|
|
|
|
aarch64DarwinFix
|
|
|
|
|
]
|