at 22.05-pre 61 lines 2.1 kB view raw
1{ lib, haskellPackages, haskell, removeReferencesTo 2# “Plugins” are a fancy way of saying gitit will invoke 3# GHC at *runtime*, which in turn makes it pull GHC 4# into its runtime closure. Only enable if you really need 5# that feature. But if you do you’ll want to use gitit 6# as a library anyway. 7, pluginSupport ? false 8}: 9 10# this is similar to what we do with the pandoc executable 11 12let 13 plain = haskellPackages.gitit; 14 plugins = 15 if pluginSupport 16 then plain 17 else haskell.lib.compose.disableCabalFlag "plugins" plain; 18 static = haskell.lib.compose.justStaticExecutables plugins; 19 20in 21 (haskell.lib.compose.overrideCabal (drv: { 22 buildTools = (drv.buildTools or []) ++ [ removeReferencesTo ]; 23 }) static).overrideAttrs (drv: { 24 25 # These libraries are still referenced, because they generate 26 # a `Paths_*` module for figuring out their version. 27 # The `Paths_*` module is generated by Cabal, and contains the 28 # version, but also paths to e.g. the data directories, which 29 # lead to a transitive runtime dependency on the whole GHC distribution. 30 # This should ideally be fixed in haskellPackages (or even Cabal), 31 # but a minimal gitit is important enough to patch it manually. 32 disallowedReferences = [ 33 haskellPackages.pandoc-types 34 haskellPackages.HTTP 35 haskellPackages.pandoc 36 haskellPackages.happstack-server 37 haskellPackages.filestore 38 ]; 39 postInstall = '' 40 remove-references-to \ 41 -t ${haskellPackages.pandoc-types} \ 42 $out/bin/gitit 43 remove-references-to \ 44 -t ${haskellPackages.HTTP} \ 45 $out/bin/gitit 46 remove-references-to \ 47 -t ${haskellPackages.pandoc} \ 48 $out/bin/gitit 49 remove-references-to \ 50 -t ${haskellPackages.happstack-server} \ 51 $out/bin/gitit 52 remove-references-to \ 53 -t ${haskellPackages.filestore} \ 54 $out/bin/gitit 55 ''; 56 57 meta = drv.meta // { 58 maintainers = drv.meta.maintainers or [] 59 ++ [ lib.maintainers.Profpatsch ]; 60 }; 61 })