Module for gitit

This commit is contained in:
2021-12-31 13:35:22 +02:00
commit 78340b56f7
6 changed files with 399 additions and 0 deletions

40
gitit/cabal.nix Normal file
View File

@ -0,0 +1,40 @@
{ mkDerivation, aeson, base, base64-bytestring, blaze-html
, bytestring, ConfigFile, containers, directory, doctemplates, feed
, fetchgit, filepath, filestore, ghc, ghc-paths, happstack-server
, hoauth2, hslogger, HStringTemplate, HTTP, http-client-tls
, http-conduit, json, lib, mtl, network, network-bsd, network-uri
, old-locale, old-time, pandoc, pandoc-types, parsec, pretty
, process, random, recaptcha, safe, SHA, skylighting, split, syb
, tagsoup, temporary, text, time, uri-bytestring, url, utf8-string
, uuid, xhtml, xml, xml-conduit, xml-types, xss-sanitize, zlib
}:
mkDerivation {
pname = "gitit";
version = "0.15.1.0";
src = fetchgit {
url = "https://github.com/jgm/gitit";
sha256 = "0rzjgi6q338n6cv74438q81v322x2wjrpa7zdvp47z6hrilwpqaa";
rev = "11a18b034cc49ddaca652ac745fd308405a1fdad";
fetchSubmodules = true;
};
isLibrary = true;
isExecutable = true;
enableSeparateDataOutput = true;
libraryHaskellDepends = [
aeson base base64-bytestring blaze-html bytestring ConfigFile
containers directory doctemplates feed filepath filestore ghc
ghc-paths happstack-server hoauth2 hslogger HStringTemplate HTTP
http-client-tls http-conduit json mtl network network-bsd
network-uri old-locale old-time pandoc pandoc-types parsec pretty
process random recaptcha safe SHA skylighting split syb tagsoup
temporary text time uri-bytestring url utf8-string uuid xhtml xml
xml-conduit xml-types xss-sanitize zlib
];
executableHaskellDepends = [
base bytestring directory filepath hslogger HTTP mtl network
network-uri syb text url utf8-string
];
description = "Wiki using happstack, git or darcs, and pandoc";
license = "GPL";
}

62
gitit/default.nix Normal file
View File

@ -0,0 +1,62 @@
{ lib, haskellPackages, haskell, removeReferencesTo
# “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
}:
# this is similar to what we do with the pandoc executable
let
plain = haskellPackages.callPackage ./cabal.nix {};
plugins =
if pluginSupport
then plain
else haskell.lib.compose.disableCabalFlag "plugins" plain;
static = haskell.lib.compose.justStaticExecutables plugins;
in
(haskell.lib.compose.overrideCabal (drv: {
buildTools = (drv.buildTools or []) ++ [ removeReferencesTo ];
}) static).overrideAttrs (drv: {
# These libraries are still referenced, because they generate
# a `Paths_*` module for figuring out their version.
# The `Paths_*` module is generated by Cabal, and contains the
# version, but also paths to e.g. the data directories, which
# lead to a transitive runtime dependency on the whole GHC distribution.
# This should ideally be fixed in haskellPackages (or even Cabal),
# but a minimal gitit is important enough to patch it manually.
disallowedReferences = [
haskellPackages.pandoc-types
haskellPackages.HTTP
haskellPackages.pandoc
haskellPackages.happstack-server
haskellPackages.filestore
];
postInstall = ''
remove-references-to \
-t ${haskellPackages.pandoc-types} \
$out/bin/gitit
remove-references-to \
-t ${haskellPackages.HTTP} \
$out/bin/gitit
remove-references-to \
-t ${haskellPackages.pandoc} \
$out/bin/gitit
remove-references-to \
-t ${haskellPackages.happstack-server} \
$out/bin/gitit
remove-references-to \
-t ${haskellPackages.filestore} \
$out/bin/gitit
'';
meta = drv.meta // {
maintainers = drv.meta.maintainers or []
++ [ lib.maintainers.Profpatsch ];
};
})