1{ lib
2, rustPlatform
3, fetchCrate
4, pkg-config
5, libgit2
6, openssl
7, stdenv
8, expat
9, fontconfig
10, libGL
11, xorg
12, darwin
13}:
14
15rustPlatform.buildRustPackage rec {
16 pname = "cargo-ui";
17 version = "0.3.3";
18
19 src = fetchCrate {
20 inherit pname version;
21 hash = "sha256-M/ljgtTHMSc7rY/a8CpKGNuOSdVDwRt6+tzPPHdpKOw=";
22 };
23
24 cargoHash = "sha256-u3YqXQZCfveSBjxdWb+GC0IA9bpruAYQdxX1zanT3fw=";
25
26 nativeBuildInputs = [
27 pkg-config
28 ];
29
30 buildInputs = [
31 libgit2
32 openssl
33 ] ++ lib.optionals stdenv.isLinux [
34 expat
35 fontconfig
36 libGL
37 xorg.libX11
38 xorg.libXcursor
39 xorg.libXi
40 xorg.libXrandr
41 xorg.libxcb
42 ] ++ lib.optionals stdenv.isDarwin [
43 darwin.apple_sdk.frameworks.AppKit
44 ];
45
46 postFixup = lib.optionalString stdenv.isLinux ''
47 patchelf $out/bin/cargo-ui \
48 --add-rpath ${lib.makeLibraryPath [ fontconfig libGL ]}
49 '';
50
51 env = {
52 LIBGIT2_NO_VENDOR = 1;
53 };
54
55 meta = with lib; {
56 description = "GUI for Cargo";
57 mainProgram = "cargo-ui";
58 homepage = "https://github.com/slint-ui/cargo-ui";
59 changelog = "https://github.com/slint-ui/cargo-ui/blob/v${version}/CHANGELOG.md";
60 license = with licenses; [ mit asl20 gpl3Only ];
61 maintainers = with maintainers; [ figsoda matthiasbeyer ];
62 };
63}