about summary refs log tree commit diff
path: root/pkgs/applications/version-management/gitstats/default.nix
blob: a795f0f6f6dd3ff156e8d86a1e9f904b46e4b0bd (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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
{ lib
, stdenv
, fetchFromGitHub
, fetchpatch
, installShellFiles
, perl
, python3
, 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=";
  };

  patches = [
    # make gitstats compatible with python3
    # https://github.com/hoxu/gitstats/pull/105
    (fetchpatch {
      name = "convert-gitstats-to-use-python3.patch";
      url = "https://github.com/hoxu/gitstats/commit/ca415668ce6b739ca9fefba6acd29c63b89f4211.patch";
      hash = "sha256-sgjoj8eQ5CxQBffmhqymsmXb8peuaSbfFoWciLK3LOo=";
    })
  ];

  nativeBuildInputs = [ installShellFiles perl ];

  buildInputs = [ python3 ];

  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
  '';

  makeFlags = [
    "PREFIX=$(out)"
    "VERSION=${version}"
  ];

  buildFlags = [ "man" ];

  postInstall = ''
    installManPage doc/gitstats.1
  '';

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