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