1{
2 lib,
3 stdenv,
4 rustPlatform,
5 fetchFromGitHub,
6 makeBinaryWrapper,
7 writableTmpDirAsHomeHook,
8 libGL,
9 libX11,
10 libxkbcommon,
11 libxcb,
12 wayland,
13 nix-update-script,
14}:
15
16rustPlatform.buildRustPackage (finalAttrs: {
17 pname = "ferrishot";
18 version = "0.2.0";
19
20 src = fetchFromGitHub {
21 owner = "nik-rev";
22 repo = "ferrishot";
23 tag = "v${finalAttrs.version}";
24 hash = "sha256-QnIHLkxqL/4s6jgIbGmzR5tqCjH7yJcfpx0AhdxqVKc=";
25 };
26
27 cargoHash = "sha256-TJWS8LzLTQSr+0uw0x38mNJrjYvMzr90URYI8UcRQqc=";
28
29 nativeBuildInputs = [
30 makeBinaryWrapper
31 ]
32 ++ lib.optionals stdenv.hostPlatform.isDarwin [
33 # error: unable to open output file '/homeless-shelter/.cache/clang/ModuleCache/354UBE8EJRBZ3/Cocoa-31YYBL2V1XGQP.pcm': 'No such file or directory'
34 writableTmpDirAsHomeHook
35 ];
36
37 buildInputs = lib.optionals stdenv.hostPlatform.isLinux [
38 libxcb
39 ];
40
41 postInstall =
42 let
43 runtimeDeps = [
44 libGL
45 ]
46 ++ lib.optionals stdenv.hostPlatform.isLinux [
47 libX11
48 libxkbcommon
49 wayland
50 ];
51 in
52 ''
53 wrapProgram $out/bin/ferrishot \
54 --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath runtimeDeps}"
55 '';
56
57 passthru = {
58 updateScript = nix-update-script { };
59 };
60
61 meta = {
62 description = "Screenshot app written in Rust";
63 homepage = "https://github.com/nik-rev/ferrishot";
64 changelog = "https://github.com/nik-rev/ferrishot/blob/v${finalAttrs.version}/CHANGELOG.md";
65 license = lib.licenses.mit;
66 maintainers = with lib.maintainers; [ GaetanLepage ];
67 mainProgram = "ferrishot";
68 };
69})