lol
1{ lib
2, fetchFromGitHub
3, fetchpatch
4, rustPlatform
5, tree-sitter
6, difftastic
7, testers
8}:
9
10rustPlatform.buildRustPackage rec {
11 pname = "difftastic";
12 version = "0.38.0";
13
14 src = fetchFromGitHub {
15 owner = "wilfred";
16 repo = pname;
17 rev = version;
18 sha256 = "sha256-NhuFyJvXk3N9G6LedAPwJIDdd0CfFs1rjYmC1tJTqB8=";
19 };
20
21 depsExtraArgs = {
22 postBuild = let
23 mimallocPatch = (fetchpatch {
24 name = "mimalloc-older-macos-fixes.patch";
25 url = "https://github.com/microsoft/mimalloc/commit/40e0507a5959ee218f308d33aec212c3ebeef3bb.patch";
26 stripLen = 1;
27 extraPrefix = "libmimalloc-sys/c_src/mimalloc/";
28 sha256 = "1cqgay6ayzxsj8v1dy8405kwd8av34m4bjc84iyg9r52amlijbg4";
29 });
30 in ''
31 pushd $name
32 patch -p1 < ${mimallocPatch}
33 substituteInPlace libmimalloc-sys/.cargo-checksum.json \
34 --replace \
35 '6a2e9f0db0d3de160f9f15ddc8a870dbc42bba724f19f1e69b8c4952cb36821a' \
36 '201ab8874d9ba863406e084888e492b785a7edae00a222f395c079028d21a89a' \
37 --replace \
38 'a87a27e8432a63e5de25703ff5025588afd458e3a573e51b3c3dee2281bff0d4' \
39 'ab98a2da81d2145003a9cba7b7025efbd2c7b37c7a23c058c150705a3ec39298'
40 popd
41 '';
42 };
43 cargoSha256 = "sha256-0XqLdjF9O8CRVyq7j7IvOqCUB0oCV2P703BcWwSlIx8=";
44
45 passthru.tests.version = testers.testVersion { package = difftastic; };
46
47 meta = with lib; {
48 description = "A syntax-aware diff";
49 homepage = "https://github.com/Wilfred/difftastic";
50 changelog = "https://github.com/Wilfred/difftastic/raw/${version}/CHANGELOG.md";
51 license = licenses.mit;
52 maintainers = with maintainers; [ ethancedwards8 figsoda ];
53 mainProgram = "difft";
54 };
55}