nixpkgs/pkgs/applications/version-management/git-and-tools/cgit/default.nix

83 lines
2.5 KiB
Nix
Raw Normal View History

2021-01-15 13:21:58 +00:00
{ lib, stdenv, fetchurl, openssl, zlib, asciidoc, libxml2, libxslt
, docbook_xsl, pkgconfig, luajit
2019-06-10 23:10:01 +00:00
, coreutils, gnused, groff, docutils
, gzip, bzip2, lzip, xz, zstd
2018-03-19 18:42:25 +00:00
, python, wrapPython, pygments, markdown
}:
stdenv.mkDerivation rec {
pname = "cgit";
version = "1.2.3";
src = fetchurl {
url = "https://git.zx2c4.com/cgit/snapshot/${pname}-${version}.tar.xz";
sha256 = "193d990ym10qlslk0p8mjwp2j6rhqa7fq0y1iff65lvbyv914pss";
};
2014-05-17 09:01:57 +00:00
# cgit is tightly coupled with git and needs a git source tree to build.
# IMPORTANT: Remember to check which git version cgit needs on every version
2016-12-27 14:46:22 +00:00
# bump (look for "GIT_VER" in the top-level Makefile).
gitSrc = fetchurl {
url = "mirror://kernel/software/scm/git/git-2.25.1.tar.xz";
sha256 = "09lzwa183nblr6l8ib35g2xrjf9wm9yhk3szfvyzkwivdv69c9r2";
};
2018-03-19 18:42:25 +00:00
nativeBuildInputs = [ pkgconfig ] ++ [ python wrapPython ];
buildInputs = [
openssl zlib asciidoc libxml2 libxslt docbook_xsl luajit
];
2018-03-19 18:42:25 +00:00
pythonPath = [ pygments markdown ];
postPatch = ''
sed -e 's|"gzip"|"${gzip}/bin/gzip"|' \
-e 's|"bzip2"|"${bzip2.bin}/bin/bzip2"|' \
-e 's|"lzip"|"${lzip}/bin/lzip"|' \
-e 's|"xz"|"${xz.bin}/bin/xz"|' \
-e 's|"zstd"|"${zstd}/bin/zstd"|' \
-i ui-snapshot.c
substituteInPlace filters/html-converters/man2html \
--replace 'groff' '${groff}/bin/groff'
2019-06-10 23:10:01 +00:00
substituteInPlace filters/html-converters/rst2html \
--replace 'rst2html.py' '${docutils}/bin/rst2html.py'
'';
# Give cgit a git source tree and pass configuration parameters (as make
# variables).
preBuild = ''
mkdir -p git
tar --strip-components=1 -xf "$gitSrc" -C git
makeFlagsArray+=(prefix="$out" CGIT_SCRIPT_PATH="$out/cgit/")
'';
# Install manpage.
postInstall = ''
# xmllint fails:
#make install-man
# bypassing xmllint works:
a2x --no-xmllint -f manpage cgitrc.5.txt
mkdir -p "$out/share/man/man5"
cp cgitrc.5 "$out/share/man/man5"
2018-03-19 18:42:25 +00:00
wrapPythonProgramsIn "$out/lib/cgit/filters" "$out $pythonPath"
2019-06-10 23:10:01 +00:00
for script in $out/lib/cgit/filters/*.sh $out/lib/cgit/filters/html-converters/txt2html; do
2021-01-15 13:21:58 +00:00
wrapProgram $script --prefix PATH : '${lib.makeBinPath [ coreutils gnused ]}'
2019-06-10 23:10:01 +00:00
done
'';
stripDebugList = [ "cgit" ];
meta = {
homepage = "https://git.zx2c4.com/cgit/about/";
repositories.git = "git://git.zx2c4.com/cgit";
description = "Web frontend for git repositories";
2021-01-15 13:21:58 +00:00
license = lib.licenses.gpl2;
platforms = lib.platforms.linux;
maintainers = with lib.maintainers; [ bjornfor ];
};
}