summary refs log tree commit diff
path: root/pkgs/tools/misc/grc/default.nix
blob: e8f4282fb19378fd5fe9d043aaf60a11c176e654 (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
{ lib
, fetchFromGitHub
, buildPythonApplication
, installShellFiles
}:

buildPythonApplication rec {
  pname = "grc";
  version = "1.13";
  format = "other";

  src = fetchFromGitHub {
    owner = "garabik";
    repo = pname;
    rev = "v${version}";
    sha256 = "1h0h88h484a9796hai0wasi1xmjxxhpyxgixn6fgdyc5h69gv8nl";
  };

  postPatch = ''
    for f in grc grcat; do
      substituteInPlace $f \
        --replace /usr/local/ $out/
    done

    # Support for absolute store paths.
    substituteInPlace grc.conf \
      --replace "^([/\w\.]+\/)" "^([/\w\.\-]+\/)"
  '';

  nativeBuildInputs = [ installShellFiles ];

  installPhase = ''
    runHook preInstall

    ./install.sh "$out" "$out"
    installShellCompletion --zsh --name _grc _grc

    runHook postInstall
  '';

  meta = with lib; {
    homepage = "http://kassiopeia.juls.savba.sk/~garabik/software/grc.html";
    description = "A generic text colouriser";
    longDescription = ''
      Generic Colouriser is yet another colouriser (written in Python) for
      beautifying your logfiles or output of commands.
    '';
    license = licenses.gpl2Plus;
    maintainers = with maintainers; [ azahi lovek323 AndersonTorres peterhoeg ];
    platforms = platforms.unix;
    mainProgram = "grc";
  };
}