Merge pull request #128077 from doronbehar/pkg/imagej
This commit is contained in:
commit
a9a0ec0414
@ -1,48 +1,74 @@
|
|||||||
{ lib, stdenv, fetchurl, jre, unzip, makeWrapper }:
|
{ lib
|
||||||
|
, stdenv
|
||||||
# Note:
|
, fetchurl
|
||||||
# - User config dir is hard coded by upstream to $HOME/.imagej on linux systems
|
, jre
|
||||||
# and to $HOME/Library/Preferences on macOS.
|
, unzip
|
||||||
# (The current trend appears to be to use $HOME/.config/imagej
|
, makeWrapper
|
||||||
# on linux systems, but we here do not attempt to fix it.)
|
, makeDesktopItem
|
||||||
|
, copyDesktopItems
|
||||||
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
imagej150 = stdenv.mkDerivation {
|
icon = fetchurl {
|
||||||
pname = "imagej";
|
url = "https://imagej.net/media/icons/imagej.png";
|
||||||
version = "150";
|
sha256 = "sha256-nU2nWI1wxZB/xlOKsZzdUjj+qiCTjO6GwEKYgZ5Risg=";
|
||||||
|
|
||||||
src = fetchurl {
|
|
||||||
url = "https://wsr.imagej.net/distros/cross-platform/ij150.zip";
|
|
||||||
sha256 = "97aba6fc5eb908f5160243aebcdc4965726693cb1353d9c0d71b8f5dd832cb7b";
|
|
||||||
};
|
|
||||||
nativeBuildInputs = [ makeWrapper unzip ];
|
|
||||||
inherit jre;
|
|
||||||
|
|
||||||
# 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 = ''
|
|
||||||
mkdir -p $out/share/java
|
|
||||||
# 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
|
|
||||||
mkdir $out/bin
|
|
||||||
makeWrapper ${jre}/bin/java $out/bin/imagej \
|
|
||||||
--add-flags "-jar $out/share/java/ij.jar -ijpath $out/share"
|
|
||||||
'';
|
|
||||||
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.
|
|
||||||
'';
|
|
||||||
license = licenses.publicDomain;
|
|
||||||
platforms = with platforms; linux ++ darwin;
|
|
||||||
maintainers = with maintainers; [ yuriaisaka ];
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
in
|
in stdenv.mkDerivation rec {
|
||||||
imagej150
|
pname = "imagej";
|
||||||
|
version = "153";
|
||||||
|
|
||||||
|
src = fetchurl {
|
||||||
|
url = "https://wsr.imagej.net/distros/cross-platform/ij${version}.zip";
|
||||||
|
sha256 = "sha256-MGuUdUDuW3s/yGC68rHr6xxzmYScUjdXRawDpc1UQqw=";
|
||||||
|
};
|
||||||
|
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;
|
||||||
|
};
|
||||||
|
|
||||||
|
# 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
|
||||||
|
makeWrapper ${jre}/bin/java $out/bin/imagej \
|
||||||
|
--add-flags "-jar $out/share/java/ij.jar -ijpath $out/share"
|
||||||
|
|
||||||
|
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";
|
||||||
|
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.
|
||||||
|
'';
|
||||||
|
license = licenses.publicDomain;
|
||||||
|
platforms = platforms.unix;
|
||||||
|
maintainers = with maintainers; [ yuriaisaka ];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user