about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/graphics/emulsion/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/applications/graphics/emulsion/default.nix')
-rw-r--r--nixpkgs/pkgs/applications/graphics/emulsion/default.nix85
1 files changed, 85 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/applications/graphics/emulsion/default.nix b/nixpkgs/pkgs/applications/graphics/emulsion/default.nix
new file mode 100644
index 000000000000..133deec19521
--- /dev/null
+++ b/nixpkgs/pkgs/applications/graphics/emulsion/default.nix
@@ -0,0 +1,85 @@
+{ stdenv
+, lib
+, fetchFromGitHub
+, rustPlatform
+, installShellFiles
+, makeWrapper
+, pkg-config
+, python3
+, libGL
+, libX11
+, libXcursor
+, libXi
+, libXrandr
+, libXxf86vm
+, libxcb
+, libxkbcommon
+, wayland
+, xdg_utils
+, AppKit
+, CoreGraphics
+, CoreServices
+, Foundation
+, OpenGL
+}:
+let
+  rpathLibs = [
+    libGL
+    libX11
+    libXcursor
+    libXi
+    libXrandr
+    libXxf86vm
+    libxcb
+  ] ++ lib.optionals stdenv.isLinux [
+    libxkbcommon
+    wayland
+  ];
+in
+rustPlatform.buildRustPackage rec {
+  pname = "emulsion";
+  version = "8.0";
+
+  src = fetchFromGitHub {
+    owner = "ArturKovacs";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "sha256-xv3q59HobunrFyc+CPLztpsQd20Eu4+JI+iYhlGI0bc=";
+  };
+
+  cargoSha256 = "sha256-37xtdFbtbfGUqaSpzlxDQfe1+0ESHz/rgO1iTPBEBLc=";
+
+  nativeBuildInputs = [
+    installShellFiles
+    makeWrapper
+    pkg-config
+    python3
+  ];
+
+  buildInputs = rpathLibs ++ lib.optionals stdenv.isDarwin [
+    AppKit
+    CoreGraphics
+    CoreServices
+    Foundation
+    OpenGL
+  ];
+
+  installPhase = ''
+    runHook preInstall
+    install -D $releaseDir/emulsion $out/bin/emulsion
+  '' + lib.optionalString stdenv.isLinux ''
+      patchelf --set-rpath "${lib.makeLibraryPath rpathLibs}" $out/bin/emulsion
+  '' + ''
+    runHook postInstall
+  '';
+
+  dontPatchELF = true;
+
+  meta = with lib; {
+    description = "A fast and minimalistic image viewer";
+    homepage = "https://arturkovacs.github.io/emulsion-website/";
+    maintainers = [ maintainers.magnetophon ];
+    platforms = platforms.unix;
+    license = licenses.mit;
+  };
+}