lol
1{ lib
2, fetchpatch
3, rustPlatform
4, fetchFromGitHub
5, testers
6, difftastic
7, stdenv
8}:
9
10let
11 mimallocPatch = fetchpatch {
12 name = "fix-build-on-older-macos-releases.patch";
13 url = "https://github.com/microsoft/mimalloc/commit/40e0507a5959ee218f308d33aec212c3ebeef3bb.patch";
14 sha256 = "sha256-DK0LqsVXXiEVQSQCxZ5jyZMg0UJJx9a/WxzCroYSHZc=";
15 };
16in
17
18rustPlatform.buildRustPackage rec {
19 pname = "difftastic";
20 version = "0.56.1";
21
22 src = fetchFromGitHub {
23 owner = "wilfred";
24 repo = pname;
25 rev = version;
26 hash = "sha256-XQzsLowHtgXIKfUWx1Sj1D0F8scb7fNp33Cwfh5XvJI=";
27 };
28
29 cargoLock = {
30 lockFile = ./Cargo.lock;
31 outputHashes = {
32 "tree_magic_mini-3.0.2" = "sha256-iIX/DeDbquObDPOx/pctVFN4R8GSkD9bPNkNgOLdUJs=";
33 };
34 };
35
36 # skip flaky tests
37 checkFlags = [
38 "--skip=options::tests::test_detect_display_width"
39 ];
40
41 postPatch = ''
42 patch -d $cargoDepsCopy/libmimalloc-sys-0.1.24/c_src/mimalloc \
43 -p1 < ${mimallocPatch}
44 '';
45
46 passthru.tests.version = testers.testVersion { package = difftastic; };
47
48 meta = with lib; {
49 description = "A syntax-aware diff";
50 homepage = "https://github.com/Wilfred/difftastic";
51 changelog = "https://github.com/Wilfred/difftastic/blob/${version}/CHANGELOG.md";
52 license = licenses.mit;
53 maintainers = with maintainers; [ ethancedwards8 figsoda ];
54 mainProgram = "difft";
55 };
56}