summary refs log tree commit diff
path: root/pkgs/applications/version-management/gita/default.nix
blob: f2d9d2a9f66d1b787c77fd165d9ec1f2a1960a7f (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
{ lib
, buildPythonApplication
, fetchFromGitHub
, git
, pytest
, pyyaml
, setuptools
, installShellFiles
}:

buildPythonApplication rec {
  version = "0.11.9";
  pname = "gita";

  src = fetchFromGitHub {
    sha256 = "9+zuLAx9lMfltsBqjvsivJ5wPnStPfq11XgGMv/JDpY=";
    rev = version;
    repo = "gita";
    owner = "nosarthur";
  };

  propagatedBuildInputs = [
    pyyaml
    setuptools
  ];

  nativeBuildInputs = [ installShellFiles ];

  postUnpack = ''
    for case in "\n" ""; do
        substituteInPlace source/tests/test_main.py \
         --replace "'gita$case'" "'source$case'"
    done
  '';

  nativeCheckInputs = [
    git
    pytest
  ];

  checkPhase = ''
    git init
    pytest tests
  '';

  postInstall = ''
    installShellCompletion --bash --name gita ${src}/.gita-completion.bash
    installShellCompletion --zsh --name gita ${src}/.gita-completion.zsh
  '';

  meta = with lib; {
    description = "A command-line tool to manage multiple git repos";
    homepage = "https://github.com/nosarthur/gita";
    license = licenses.mit;
    maintainers = with maintainers; [ seqizz ];
  };
}