Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 stdenv, 4 haskellPackages, 5 haskell, 6 # “Plugins” are a fancy way of saying gitit will invoke 7 # GHC at *runtime*, which in turn makes it pull GHC 8 # into its runtime closure. Only enable if you really need 9 # that feature. But if you do you’ll want to use gitit 10 # as a library anyway. 11 pluginSupport ? false, 12}: 13 14let 15 inherit (haskell.lib.compose) 16 enableCabalFlag 17 disableCabalFlag 18 justStaticExecutables 19 overrideCabal 20 ; 21 22 base = 23 (if pluginSupport then enableCabalFlag else disableCabalFlag) "plugins" 24 haskellPackages.gitit; 25 26 # Removes erroneous references from dead code that GHC can't eliminate 27 aarch64DarwinFix = overrideCabal ( 28 drv: 29 lib.optionalAttrs (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) { 30 postInstall = '' 31 ${drv.postInstall or ""} 32 remove-references-to -t ${haskellPackages.HTTP} "$out/bin/gitit" 33 remove-references-to -t ${haskellPackages.HTTP} "$out/bin/expireGititCache" 34 remove-references-to -t ${haskellPackages.happstack-server} "$out/bin/gitit" 35 remove-references-to -t ${haskellPackages.hoauth2} "$out/bin/gitit" 36 remove-references-to -t ${haskellPackages.pandoc} "$out/bin/gitit" 37 remove-references-to -t ${haskellPackages.pandoc-types} "$out/bin/gitit" 38 ''; 39 } 40 ); 41in 42 43if pluginSupport then 44 base 45else 46 lib.pipe (base.override { ghc-paths = null; }) [ 47 justStaticExecutables 48 aarch64DarwinFix 49 ]