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