1{
2 lib,
3 rustPlatform,
4 fetchFromGitHub,
5 pkg-config,
6 openssl,
7 libgit2,
8 zlib,
9 fetchpatch,
10}:
11
12rustPlatform.buildRustPackage rec {
13 pname = "git-trim";
14 version = "0.4.4";
15
16 src = fetchFromGitHub {
17 owner = "foriequal0";
18 repo = "git-trim";
19 rev = "v${version}";
20 sha256 = "sha256-XAO3Qg5I2lYZVNx4+Z5jKHRIFdNwBJsUQwJXFb4CbvM=";
21 };
22
23 cargoHash = "sha256-irgekVTWCujzSbZQMNJw3NZ3cjaUftpSJha6iZQqYJ8=";
24
25 cargoPatches = [
26 # Update git2 https://github.com/foriequal0/git-trim/pull/202
27 (fetchpatch {
28 url = "https://github.com/foriequal0/git-trim/commit/4355cd1d6f605455087c4d7ad16bfb92ffee941f.patch";
29 sha256 = "sha256-C1pX4oe9ZCgvqYTBJeSjMdr0KFyjv2PNVMJDlwCAngY=";
30 })
31 ];
32
33 OPENSSL_NO_VENDOR = 1;
34
35 nativeBuildInputs = [ pkg-config ];
36
37 buildInputs = [
38 openssl
39 libgit2
40 zlib
41 ];
42
43 postInstall = ''
44 install -Dm644 -t $out/share/man/man1/ docs/git-trim.1
45 '';
46
47 # fails with sandbox
48 doCheck = false;
49
50 meta = with lib; {
51 description = "Automatically trims your branches whose tracking remote refs are merged or gone";
52 homepage = "https://github.com/foriequal0/git-trim";
53 license = licenses.mit;
54 maintainers = with maintainers; [ cafkafk ];
55 mainProgram = "git-trim";
56 };
57}