nixpkgs/pkgs/by-name/gi/gitit/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
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.
2024-11-09 20:04:51 +08:00

43 lines
1.4 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{ 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 youll 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
]