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