summary refs log tree commit diff
path: root/pkgs/applications/version-management/git-and-tools/git-branchless/default.nix
blob: c80db8ee9582d7c2e53c8c1602d4fbd26d16f83d (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
{ lib, fetchFromGitHub

, coreutils
, git
, ncurses
, rustPlatform
, sqlite
}:

rustPlatform.buildRustPackage rec {
  pname = "git-branchless";
  version = "0.3.2";

  src = fetchFromGitHub {
    owner = "arxanas";
    repo = "git-branchless";
    rev = "v${version}";
    sha256 = "0pfiyb23ah1h6risrhjr8ky7b1k1f3yfc3z70s92q3czdlrk6k07";
  };

  cargoSha256 = "0gplx80xhpz8kwry7l4nv4rlj9z02jg0sgb6zy1y3vd9s2j5wals";

  # Remove path hardcodes patching if they get fixed upstream, see:
  # https://github.com/arxanas/git-branchless/issues/26
  postPatch = ''
    # Inline test hardcodes `echo` location.
    substituteInPlace ./src/commands/wrap.rs --replace '/bin/echo' '${coreutils}/bin/echo'

    # Tests in general hardcode `git` location.
    substituteInPlace ./src/testing.rs --replace '/usr/bin/git' '${git}/bin/git'
  '';

  buildInputs = [
    ncurses
    sqlite
  ];

  preCheck = ''
    # Tests require path to git.
    export PATH_TO_GIT=${git}/bin/git
  '';

  meta = with lib; {
    description = "A suite of tools to help you visualize, navigate, manipulate, and repair your commit history";
    homepage = "https://github.com/arxanas/git-branchless";
    license = licenses.asl20;
    maintainers = with maintainers; [ nh2 ];
  };
}