summary refs log tree commit diff
path: root/pkgs/tools/text/difftastic/default.nix
blob: 32644fdf28b2970f50f375c64727df545a1f8131 (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
{ lib, fetchFromGitHub, rustPlatform, tree-sitter }:

rustPlatform.buildRustPackage rec {
  pname = "difftastic";
  version = "0.10.1";

  src = fetchFromGitHub {
    owner = "wilfred";
    repo = pname;
    rev = version;
    sha256 = "12fcfwx56phs64yl94al2hkvss1km4n9wbrn2md7wfh1137jykbg";
  };

  cargoSha256 = "0xnlnkdvsd2l7acdrkz918cjkk36k01rvvm0c8hnpx5327v6nsa8";

  postPatch = ''
    pushd vendor
    for grammar in */; do
      if [ -d "${tree-sitter.grammars}/$grammar" ]; then
        rm -r "$grammar"
        ln -s "${tree-sitter.grammars}/$grammar"
      fi
    done
    popd
  '';

  meta = with lib; {
    description = "A syntax-aware diff";
    homepage = "https://github.com/Wilfred/difftastic";
    changelog = "https://github.com/Wilfred/difftastic/raw/${version}/CHANGELOG.md";
    license = licenses.mit;
    maintainers = with maintainers; [ ethancedwards8 figsoda ];
  };
}