1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 fetchpatch,
6 installShellFiles,
7 perl,
8 python3,
9 gnuplot,
10 coreutils,
11 gnugrep,
12}:
13
14stdenv.mkDerivation rec {
15 pname = "gitstats";
16 version = "2016-01-08";
17
18 # upstream does not make releases
19 src = fetchFromGitHub {
20 owner = "hoxu";
21 repo = "gitstats";
22 rev = "55c5c285558c410bb35ebf421245d320ab9ee9fa";
23 sha256 = "sha256-qUQB3aCRbPkbMoMf39kPQ0vil8RjXL8RqjdTryfkzK0=";
24 };
25
26 patches = [
27 # make gitstats compatible with python3
28 # https://github.com/hoxu/gitstats/pull/105
29 (fetchpatch {
30 name = "convert-gitstats-to-use-python3.patch";
31 url = "https://github.com/hoxu/gitstats/commit/ca415668ce6b739ca9fefba6acd29c63b89f4211.patch";
32 hash = "sha256-sgjoj8eQ5CxQBffmhqymsmXb8peuaSbfFoWciLK3LOo=";
33 })
34 ];
35
36 nativeBuildInputs = [
37 installShellFiles
38 perl
39 ];
40
41 buildInputs = [ python3 ];
42
43 strictDeps = true;
44
45 postPatch = ''
46 sed -e "s|gnuplot_cmd = .*|gnuplot_cmd = '${gnuplot}/bin/gnuplot'|" \
47 -e "s|\<wc\>|${coreutils}/bin/wc|g" \
48 -e "s|\<grep\>|${gnugrep}/bin/grep|g" \
49 -i gitstats
50 '';
51
52 makeFlags = [
53 "PREFIX=$(out)"
54 "VERSION=${version}"
55 ];
56
57 buildFlags = [ "man" ];
58
59 postInstall = ''
60 installManPage doc/gitstats.1
61 '';
62
63 meta = with lib; {
64 homepage = "https://gitstats.sourceforge.net/";
65 description = "Git history statistics generator";
66 license = licenses.gpl2Plus;
67 platforms = platforms.all;
68 maintainers = with maintainers; [ bjornfor ];
69 mainProgram = "gitstats";
70 };
71}