@@ -0,0 +1,85 @@
1+{ stdenv
2+, lib
3+, fetchFromGitHub
4+, rustPlatform
5+, installShellFiles
6+, makeWrapper
7+, pkg-config
8+, python3
9+, libGL
10+, libX11
11+, libXcursor
12+, libXi
13+, libXrandr
14+, libXxf86vm
15+, libxcb
16+, libxkbcommon
17+, wayland
18+, xdg_utils
19+, AppKit
20+, CoreGraphics
21+, CoreServices
22+, Foundation
23+, OpenGL
24+}:
25+let
26+ rpathLibs = [
27+ libGL
28+ libX11
29+ libXcursor
30+ libXi
31+ libXrandr
32+ libXxf86vm
33+ libxcb
34+ ] ++ lib.optionals stdenv.isLinux [
35+ libxkbcommon
36+ wayland
37+ ];
38+in
39+rustPlatform.buildRustPackage rec {
40+ pname = "emulsion";
41+ version = "7.2";
42+
43+ src = fetchFromGitHub {
44+ owner = "ArturKovacs";
45+ repo = pname;
46+ rev = "v${version}";
47+ sha256 = "1king04p5j4gsvprrfppwaxa5jn4ga4nc0v63wl6fvq2ngwnkg4g";
48+ };
49+
50+ cargoSha256 = "19vb2q5w3063l7349p1b8q40n97a4hxdvc7h7qsx1iiwp75knbd0";
51+
52+ nativeBuildInputs = [
53+ installShellFiles
54+ makeWrapper
55+ pkg-config
56+ python3
57+ ];
58+
59+ buildInputs = rpathLibs ++ lib.optionals stdenv.isDarwin [
60+ AppKit
61+ CoreGraphics
62+ CoreServices
63+ Foundation
64+ OpenGL
65+ ];
66+
67+ installPhase = ''
68+ runHook preInstall
69+ install -D $releaseDir/emulsion $out/bin/emulsion
70+ '' + lib.optionalString stdenv.isLinux ''
71+ patchelf --set-rpath "${lib.makeLibraryPath rpathLibs}" $out/bin/emulsion
72+ '' + ''
73+ runHook postInstall
74+ '';
75+
76+ dontPatchELF = true;
77+
78+ meta = with lib; {
79+ description = "A fast and minimalistic image viewer";
80+ homepage = "https://arturkovacs.github.io/emulsion-website/";
81+ maintainers = [ maintainers.magnetophon ];
82+ platforms = platforms.unix;
83+ license = licenses.mit;
84+ };
85+}