nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 92 lines 2.3 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchurl, 5 glib, 6 jre, 7 unzip, 8 makeWrapper, 9 makeDesktopItem, 10 copyDesktopItems, 11 wrapGAppsHook3, 12}: 13 14let 15 icon = fetchurl { 16 url = "https://imagej.net/media/icons/imagej.png"; 17 sha256 = "sha256-nU2nWI1wxZB/xlOKsZzdUjj+qiCTjO6GwEKYgZ5Risg="; 18 }; 19in 20stdenv.mkDerivation rec { 21 pname = "imagej"; 22 version = "153"; 23 24 src = fetchurl { 25 url = "https://wsr.imagej.net/distros/cross-platform/ij${version}.zip"; 26 sha256 = "sha256-MGuUdUDuW3s/yGC68rHr6xxzmYScUjdXRawDpc1UQqw="; 27 }; 28 nativeBuildInputs = [ 29 copyDesktopItems 30 makeWrapper 31 unzip 32 wrapGAppsHook3 33 ]; 34 buildInputs = [ glib ]; 35 dontWrapGApps = true; 36 37 desktopItems = lib.optionals stdenv.hostPlatform.isLinux [ 38 (makeDesktopItem { 39 name = "ImageJ"; 40 desktopName = "ImageJ"; 41 icon = "imagej"; 42 categories = [ 43 "Science" 44 "Utility" 45 "Graphics" 46 ]; 47 exec = "imagej"; 48 }) 49 ]; 50 51 passthru = { 52 inherit jre; 53 }; 54 55 # JAR files that are intended to be used by other packages 56 # should go to $out/share/java. 57 # (Some uses ij.jar as a library not as a standalone program.) 58 installPhase = '' 59 runHook preInstall 60 61 mkdir -p $out/share/java $out/bin 62 # Read permisssion suffices for the jar and others. 63 # Simple cp shall clear suid bits, if any. 64 cp ij.jar $out/share/java 65 cp -dR luts macros plugins $out/share 66 67 runHook postInstall 68 ''; 69 70 postFixup = lib.optionalString stdenv.hostPlatform.isLinux '' 71 makeWrapper ${jre}/bin/java $out/bin/imagej \ 72 ''${gappsWrapperArgs[@]} \ 73 --add-flags "-jar $out/share/java/ij.jar -ijpath $out/share" 74 75 install -Dm644 ${icon} $out/share/icons/hicolor/128x128/apps/imagej.png 76 ''; 77 78 meta = with lib; { 79 homepage = "https://imagej.nih.gov/ij/"; 80 description = "Image processing and analysis in Java"; 81 longDescription = '' 82 ImageJ is a public domain Java image processing program 83 inspired by NIH Image for the Macintosh. 84 It runs on any computer with a Java 1.4 or later virtual machine. 85 ''; 86 sourceProvenance = with sourceTypes; [ binaryBytecode ]; 87 license = licenses.publicDomain; 88 platforms = platforms.unix; 89 maintainers = with maintainers; [ yuriaisaka ]; 90 mainProgram = "imagej"; 91 }; 92}