@@ -0,0 +1,77 @@
1+{ stdenv
2+, lib
3+, fetchurl
4+, makeWrapper
5+, autoPatchelfHook
6+, jdk11
7+, makeDesktopItem
8+, copyDesktopItems
9+, runtimeShell
10+}:
11+stdenv.mkDerivation rec {
12+ pname = "fiji";
13+ version = "20201104-1356";
14+
15+ src = fetchurl {
16+ url = "https://downloads.imagej.net/${pname}/archive/${version}/${pname}-nojre.tar.gz";
17+ sha256 = "1jv4wjjkpid5spr2nk5xlvq3hg687qx1n5zh8zlw48y1y09c4q7a";
18+ };
19+
20+ dontBuild = true;
21+
22+ nativeBuildInputs = [ autoPatchelfHook makeWrapper copyDesktopItems ];
23+ buildInputs = [ stdenv.cc.cc.lib ];
24+
25+ desktopItems = [
26+ (makeDesktopItem {
27+ name = "fiji";
28+ exec = "fiji %F";
29+ icon = "fiji";
30+ mimeType = "image/*;";
31+ comment = "Scientific Image Analysis";
32+ desktopName = "Fiji Is Just ImageJ";
33+ genericName = "Fiji Is Just ImageJ";
34+ categories = "Education;Science;ImageProcessing;";
35+ terminal = false;
36+ startupNotify = true;
37+ extraEntries = ''
38+ Version=1.0
39+ TryExec=fiji
40+ X-GNOME-FullName=Fiji Is Just ImageJ
41+ StartupWMClass=fiji-Main
42+ '';
43+ })
44+ ];
45+
46+ installPhase = ''
47+ runHook preInstall
48+
49+ mkdir -p $out/{bin,fiji,share/pixmaps}
50+
51+ cp -R * $out/fiji
52+ rm -f $out/fiji/jars/imagej-updater-*.jar
53+
54+ # Disgusting hack to stop a local desktop entry being created
55+ cat <<EOF > $out/bin/.fiji-launcher-hack
56+ #!${runtimeShell}
57+ exec \$($out/fiji/ImageJ-linux64 --dry-run "\$@")
58+ EOF
59+ chmod +x $out/bin/.fiji-launcher-hack
60+
61+ makeWrapper $out/bin/.fiji-launcher-hack $out/bin/fiji \
62+ --prefix PATH : ${lib.makeBinPath [ jdk11 ]} \
63+ --set JAVA_HOME ${jdk11.home}
64+
65+ ln $out/fiji/images/icon.png $out/share/pixmaps/fiji.png
66+
67+ runHook postInstall
68+ '';
69+
70+ meta = with lib; {
71+ homepage = "https://imagej.net/software/fiji/";
72+ description = "batteries-included distribution of ImageJ2, bundling a lot of plugins which facilitate scientific image analysis";
73+ platforms = [ "x86_64-linux" ];
74+ license = with lib.licenses; [ gpl2Plus gpl3Plus bsd2 publicDomain ];
75+ maintainers = with maintainers; [ zane ];
76+ };
77+}