1{ lib
2, rustPlatform
3, fetchFromGitHub
4, pkg-config
5 # libgit2-sys doesn't support libgit2 1.6 yet
6, libgit2_1_5
7, oniguruma
8, zlib
9, stdenv
10, darwin
11, git
12}:
13
14rustPlatform.buildRustPackage rec {
15 pname = "git-dive";
16 version = "0.1.6";
17
18 src = fetchFromGitHub {
19 owner = "gitext-rs";
20 repo = "git-dive";
21 rev = "v${version}";
22 hash = "sha256-sy2qNFn8JLE173HVWfFXBx21jcx4kpFMwi9a0m38lso=";
23 };
24
25 cargoHash = "sha256-Z3TgVunC/qNzUe0X9xIg3fTFXFk2w9yDA+EskSCg0Qo=";
26
27 nativeBuildInputs = [
28 pkg-config
29 ];
30
31 buildInputs = [
32 libgit2_1_5
33 oniguruma
34 zlib
35 ] ++ lib.optionals stdenv.isDarwin [
36 darwin.apple_sdk.frameworks.Security
37 ];
38
39 nativeCheckInputs = [
40 git
41 ];
42
43 # don't use vendored libgit2
44 buildNoDefaultFeatures = true;
45
46 checkFlags = [
47 # requires internet access
48 "--skip=screenshot"
49 ];
50
51 preCheck = ''
52 export HOME=$(mktemp -d)
53 git config --global user.name nixbld
54 git config --global user.email nixbld@example.com
55 '';
56
57 RUSTONIG_SYSTEM_LIBONIG = true;
58
59 meta = with lib; {
60 description = "Dive into a file's history to find root cause";
61 homepage = "https://github.com/gitext-rs/git-dive";
62 changelog = "https://github.com/gitext-rs/git-dive/blob/${src.rev}/CHANGELOG.md";
63 license = with licenses; [ asl20 mit ];
64 maintainers = with maintainers; [ figsoda ];
65 };
66}