summary refs log tree commit diff
path: root/pkgs/applications/version-management/git-and-tools/gitstats/default.nix
blob: 6cfcb0077427fc6dfe7a1d8eed9d545a6b159d09 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{ lib, stdenv, fetchFromGitHub, perl, python2, gnuplot, coreutils, gnugrep }:

stdenv.mkDerivation rec {
  pname = "gitstats";
  version = "2016-01-08";

  # upstream does not make releases
  src = fetchFromGitHub {
    owner = "hoxu";
    repo = "gitstats";
    rev = "55c5c285558c410bb35ebf421245d320ab9ee9fa";
    sha256 = "sha256-qUQB3aCRbPkbMoMf39kPQ0vil8RjXL8RqjdTryfkzK0=";
  };

  nativeBuildInputs = [ perl ];

  buildInputs = [ python2 ];

  strictDeps = true;

  postPatch = ''
    sed -e "s|gnuplot_cmd = .*|gnuplot_cmd = '${gnuplot}/bin/gnuplot'|" \
        -e "s|\<wc\>|${coreutils}/bin/wc|g" \
        -e "s|\<grep\>|${gnugrep}/bin/grep|g" \
        -i gitstats
  '';

  buildPhase = ''
    make man VERSION="${version}"
  '';

  installPhase = ''
    make install PREFIX="$out" VERSION="${version}"
    install -Dm644 doc/gitstats.1 "$out"/share/man/man1/gitstats.1
  '';

  meta = with lib; {
    homepage = "http://gitstats.sourceforge.net/";
    description = "Git history statistics generator";
    license = licenses.gpl2Plus;
    platforms = platforms.all;
    maintainers = [ maintainers.bjornfor ];
  };
}