diff --git a/pkgs/applications/graphics/imagej/default.nix b/pkgs/applications/graphics/imagej/default.nix index 5050669c5242..ac1ea9560ae2 100644 --- a/pkgs/applications/graphics/imagej/default.nix +++ b/pkgs/applications/graphics/imagej/default.nix @@ -4,9 +4,16 @@ , jre , unzip , makeWrapper +, makeDesktopItem +, copyDesktopItems }: -stdenv.mkDerivation { +let + icon = fetchurl { + url = "https://imagej.net/media/icons/imagej.png"; + sha256 = "sha256-nU2nWI1wxZB/xlOKsZzdUjj+qiCTjO6GwEKYgZ5Risg="; + }; +in stdenv.mkDerivation rec { pname = "imagej"; version = "150"; @@ -14,7 +21,17 @@ stdenv.mkDerivation { url = "https://wsr.imagej.net/distros/cross-platform/ij${version}.zip"; sha256 = "97aba6fc5eb908f5160243aebcdc4965726693cb1353d9c0d71b8f5dd832cb7b"; }; - nativeBuildInputs = [ makeWrapper unzip ]; + nativeBuildInputs = [ copyDesktopItems makeWrapper unzip ]; + desktopItems = lib.optionals stdenv.isLinux [ + (makeDesktopItem { + name = "ImageJ"; + desktopName = "ImageJ"; + icon = "imagej"; + categories = "Science;Utility;Graphics;"; + exec = "imagej"; + }) + ]; + passthru = { inherit jre; }; @@ -36,6 +53,12 @@ stdenv.mkDerivation { runHook postInstall ''; + postFixup = lib.optionalString stdenv.isLinux '' + install -Dm644 ${icon} $out/share/icons/hicolor/128x128/apps/imagej.png + substituteInPlace $out/share/applications/ImageJ.desktop \ + --replace Exec=imagej Exec=$out/bin/imagej + ''; + meta = with lib; { homepage = "https://imagej.nih.gov/ij/"; description = "Image processing and analysis in Java";