1{
2 lib,
3 stdenv,
4 rustPlatform,
5 fetchFromGitHub,
6 libiconv,
7 openssl,
8 pkg-config,
9 cmake,
10 xclip,
11 nix-update-script,
12 fetchpatch,
13}:
14let
15 pname = "gitui";
16 version = "0.27.0";
17in
18rustPlatform.buildRustPackage {
19 inherit pname version;
20
21 src = fetchFromGitHub {
22 owner = "extrawurst";
23 repo = "gitui";
24 rev = "v${version}";
25 hash = "sha256-jKJ1XnF6S7clyFGN2o3bHnYpC4ckl/lNXscmf6GRLbI=";
26 };
27
28 cargoHash = "sha256-Le/dD8bTd5boz1IeEq4ItJZYC3MRW8uiT/3Zy1yv5L0=";
29
30 nativeBuildInputs = [
31 pkg-config
32 cmake
33 ];
34
35 buildInputs = [
36 openssl
37 ]
38 ++ lib.optional stdenv.hostPlatform.isLinux xclip
39 ++ lib.optionals stdenv.hostPlatform.isDarwin [
40 libiconv
41 ];
42
43 patches = [
44 # Fixes the build for rust 1.89
45 # Upstream PR: https://github.com/gitui-org/gitui/pull/2663
46 # TOREMOVE for gitui > 0.27.0
47 (fetchpatch {
48 url = "https://github.com/gitui-org/gitui/commit/950e703cab1dd37e3d02e7316ec99cc0dc70513c.patch";
49 sha256 = "sha256-KDgOPLKGuJaF0Nc6rw9FPFmcI07I8Gyp/KNX8x6+2xw=";
50 })
51 ];
52
53 postPatch = ''
54 # The cargo config overrides linkers for some targets, breaking the build
55 # on e.g. `aarch64-linux`. These overrides are not required in the Nix
56 # environment: delete them.
57 rm .cargo/config.toml
58
59 # build script tries to get version information from git
60 rm build.rs
61 substituteInPlace Cargo.toml --replace-fail 'build = "build.rs"' ""
62 '';
63
64 GITUI_BUILD_NAME = version;
65 # Needed to get openssl-sys to use pkg-config.
66 OPENSSL_NO_VENDOR = 1;
67
68 # Getting app_config_path fails with a permission denied
69 checkFlags = [
70 "--skip=keys::key_config::tests::test_symbolic_links"
71 ];
72
73 passthru.updateScript = nix-update-script { };
74
75 meta = {
76 changelog = "https://github.com/extrawurst/gitui/blob/v${version}/CHANGELOG.md";
77 description = "Blazing fast terminal-ui for Git written in Rust";
78 homepage = "https://github.com/extrawurst/gitui";
79 license = lib.licenses.mit;
80 mainProgram = "gitui";
81 maintainers = with lib.maintainers; [
82 Br1ght0ne
83 yanganto
84 mfrw
85 ];
86 };
87}