2021-06-25 09:41:59 +02:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchurl
|
2021-11-19 13:23:36 +01:00
|
|
|
, glib
|
2021-06-25 09:41:59 +02:00
|
|
|
, jre
|
|
|
|
, unzip
|
|
|
|
, makeWrapper
|
2021-06-25 09:44:59 +02:00
|
|
|
, makeDesktopItem
|
|
|
|
, copyDesktopItems
|
2021-11-19 13:23:36 +01:00
|
|
|
, wrapGAppsHook
|
2021-06-25 09:41:59 +02:00
|
|
|
}:
|
2017-05-05 08:00:38 +02:00
|
|
|
|
2021-06-25 09:44:59 +02:00
|
|
|
let
|
|
|
|
icon = fetchurl {
|
|
|
|
url = "https://imagej.net/media/icons/imagej.png";
|
|
|
|
sha256 = "sha256-nU2nWI1wxZB/xlOKsZzdUjj+qiCTjO6GwEKYgZ5Risg=";
|
|
|
|
};
|
|
|
|
in stdenv.mkDerivation rec {
|
2021-06-25 09:41:59 +02:00
|
|
|
pname = "imagej";
|
2021-06-25 09:57:17 +02:00
|
|
|
version = "153";
|
2017-05-05 08:00:38 +02:00
|
|
|
|
2021-06-25 09:41:59 +02:00
|
|
|
src = fetchurl {
|
|
|
|
url = "https://wsr.imagej.net/distros/cross-platform/ij${version}.zip";
|
2021-06-25 09:57:17 +02:00
|
|
|
sha256 = "sha256-MGuUdUDuW3s/yGC68rHr6xxzmYScUjdXRawDpc1UQqw=";
|
2021-06-25 09:41:59 +02:00
|
|
|
};
|
2021-11-19 13:23:36 +01:00
|
|
|
nativeBuildInputs = [ copyDesktopItems makeWrapper unzip wrapGAppsHook ];
|
|
|
|
buildInputs = [ glib ];
|
|
|
|
dontWrapGApps = true;
|
|
|
|
|
2021-06-25 09:44:59 +02:00
|
|
|
desktopItems = lib.optionals stdenv.isLinux [
|
|
|
|
(makeDesktopItem {
|
|
|
|
name = "ImageJ";
|
|
|
|
desktopName = "ImageJ";
|
|
|
|
icon = "imagej";
|
2022-02-22 15:56:15 +01:00
|
|
|
categories = [ "Science" "Utility" "Graphics" ];
|
2021-06-25 09:44:59 +02:00
|
|
|
exec = "imagej";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2021-06-25 09:41:59 +02:00
|
|
|
passthru = {
|
2017-05-05 08:00:38 +02:00
|
|
|
inherit jre;
|
2021-06-25 09:41:59 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
# JAR files that are intended to be used by other packages
|
|
|
|
# should go to $out/share/java.
|
|
|
|
# (Some uses ij.jar as a library not as a standalone program.)
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
mkdir -p $out/share/java $out/bin
|
|
|
|
# Read permisssion suffices for the jar and others.
|
|
|
|
# Simple cp shall clear suid bits, if any.
|
|
|
|
cp ij.jar $out/share/java
|
|
|
|
cp -dR luts macros plugins $out/share
|
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
2017-05-05 08:00:38 +02:00
|
|
|
|
2021-06-25 09:44:59 +02:00
|
|
|
postFixup = lib.optionalString stdenv.isLinux ''
|
2021-11-19 13:23:36 +01:00
|
|
|
makeWrapper ${jre}/bin/java $out/bin/imagej \
|
|
|
|
''${gappsWrapperArgs[@]} \
|
|
|
|
--add-flags "-jar $out/share/java/ij.jar -ijpath $out/share"
|
|
|
|
|
2021-06-25 09:44:59 +02:00
|
|
|
install -Dm644 ${icon} $out/share/icons/hicolor/128x128/apps/imagej.png
|
|
|
|
substituteInPlace $out/share/applications/ImageJ.desktop \
|
|
|
|
--replace Exec=imagej Exec=$out/bin/imagej
|
|
|
|
'';
|
|
|
|
|
2021-06-25 09:41:59 +02:00
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://imagej.nih.gov/ij/";
|
|
|
|
description = "Image processing and analysis in Java";
|
|
|
|
longDescription = ''
|
|
|
|
ImageJ is a public domain Java image processing program
|
|
|
|
inspired by NIH Image for the Macintosh.
|
|
|
|
It runs on any computer with a Java 1.4 or later virtual machine.
|
2017-05-05 08:00:38 +02:00
|
|
|
'';
|
2022-06-02 15:38:41 +02:00
|
|
|
sourceProvenance = with sourceTypes; [ binaryBytecode ];
|
2021-06-25 09:41:59 +02:00
|
|
|
license = licenses.publicDomain;
|
|
|
|
platforms = platforms.unix;
|
|
|
|
maintainers = with maintainers; [ yuriaisaka ];
|
2024-02-11 03:19:15 +01:00
|
|
|
mainProgram = "imagej";
|
2017-05-05 08:00:38 +02:00
|
|
|
};
|
2021-06-25 09:41:59 +02:00
|
|
|
}
|