mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-12 08:43:06 +00:00
571c71e6f7
We are migrating packages that meet below requirements: 1. using `callPackage` 2. called path is a directory 3. overriding set is empty (`{ }`) 4. not containing path expressions other than relative path (to makenixpkgs-vet happy) 5. not referenced by nix files outside of the directory, other than`pkgs/top-level/all-packages.nix` 6. not referencing nix files outside of the directory 7. not referencing `default.nix` (since it's changed to `package.nix`) 8. `outPath` doesn't change after migration The tool is here: https://github.com/Aleksanaa/by-name-migrate.
43 lines
1.4 KiB
Nix
43 lines
1.4 KiB
Nix
{ lib, stdenv, haskellPackages, haskell
|
||
# “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
|
||
inherit (haskell.lib.compose)
|
||
enableCabalFlag
|
||
disableCabalFlag
|
||
justStaticExecutables
|
||
overrideCabal
|
||
;
|
||
|
||
base = (if pluginSupport then enableCabalFlag else disableCabalFlag)
|
||
"plugins"
|
||
haskellPackages.gitit;
|
||
|
||
# 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"
|
||
'';
|
||
});
|
||
in
|
||
|
||
if pluginSupport
|
||
then base
|
||
else lib.pipe (base.override { ghc-paths = null; }) [
|
||
justStaticExecutables
|
||
aarch64DarwinFix
|
||
]
|