xmind: 7.5-update1 -> 8-update8

The latest version of XMind doesn't support a prebuilt debian package
anymore, hence a manual installation of the ZIP is needed. The new
configuration for the Java GUI had to be patched as it relied on several
paths in the ZIP that won't work anymore in a Nix-based environment.

Additionally the following changes were made:

* Manual creation of a desktop item and an icon (we're using the one
from AUR for now). Those files were available in the old `.deb`, but
that isn't supported for the latest XMind version.

* Created a patch fro `XMind.ini` to use writable paths in $HOME and fix
the path to the plugins in the store path.

* Created a custom startup script which ensures the creation of
`$HOME/.xmind` and copies the relevant files from the store path into
it. Such a behavior was available in the old `.deb` as well, but not
anymore with the new ZIP.

+88 -21
+48 -21
pkgs/applications/misc/xmind/default.nix
··· 1 - { stdenv, lib, dpkg, fetchurl, gtk2, jre, libXtst, makeWrapper }: 1 + { stdenv, lib, fetchzip, fetchurl, gtk2, jre, libXtst, makeWrapper, makeDesktopItem, runtimeShell }: 2 2 3 3 stdenv.mkDerivation rec { 4 4 name = "xmind-${version}"; 5 - version = "7.5-update1"; 5 + version = "8-update8"; 6 6 7 - src = if stdenv.hostPlatform.system == "i686-linux" then fetchurl { 8 - url = "http://dl2.xmind.net/xmind-downloads/${name}-linux_i386.deb"; 9 - sha256 = "04kr6pw0kwy715bp9wcnqnw1k5wl65xa87lhljrskm291p402jy1"; 10 - } else if stdenv.hostPlatform.system == "x86_64-linux" then fetchurl { 11 - url = "http://dl2.xmind.net/xmind-downloads/${name}-linux_amd64.deb"; 12 - sha256 = "1j2ynhk7p3m3vd6c4mjwpnlzqgfj5c4q3zydab3nfwncwx6gaqj9"; 13 - } else throw "platform ${stdenv.hostPlatform.system} not supported!"; 7 + src = fetchzip { 8 + url = "https://xmind.net/xmind/downloads/${name}-linux.zip"; 9 + stripRoot = false; 10 + sha256 = "1p68z0b4brgiyybz190alqv716ncql49vsksm41y90mcjd8s4jhn"; 11 + }; 12 + 13 + srcIcon = fetchurl { 14 + url = "https://aur.archlinux.org/cgit/aur.git/plain/xmind.png?h=xmind"; 15 + sha256 = "0jxq2fiq69q9ly0m6hx2qfybqad22sl42ciw636071khpqgc885f"; 16 + }; 14 17 15 - nativeBuildInputs = [ dpkg makeWrapper ]; 18 + patches = [ ./java-env-config-fixes.patch ]; 16 19 17 - unpackCmd = "mkdir root ; dpkg-deb -x $curSrc root"; 20 + nativeBuildInputs = [ makeWrapper ]; 18 21 19 22 dontBuild = true; 20 23 dontPatchELF = true; ··· 22 25 23 26 libPath = lib.makeLibraryPath [ gtk2 libXtst ]; 24 27 25 - installPhase = '' 26 - mkdir -p $out 27 - cp -r usr/lib/xmind $out/libexec 28 - cp -r usr/bin usr/share $out 29 - rm $out/libexec/XMind.ini 30 - mv etc/XMind.ini $out/libexec 28 + desktopItem = makeDesktopItem { 29 + name = "XMind"; 30 + exec = "XMind"; 31 + icon = "xmind"; 32 + desktopName = "XMind"; 33 + comment = meta.description; 34 + categories = "Office;"; 35 + mimeType = "application/xmind;xscheme-handler/xmind"; 36 + }; 37 + 38 + installPhase = let 39 + targetDir = if stdenv.hostPlatform.system == "i686-linux" 40 + then "XMind_i386" 41 + else "XMind_amd64"; 42 + in '' 43 + mkdir -p $out/{bin,libexec/configuration/,share/{applications/,fonts/,icons/hicolor/scalable/apps/}} 44 + cp -r ${targetDir}/{configuration,p2,XMind{,.ini}} $out/libexec 45 + cp -r {plugins,features} $out/libexec/ 46 + cp -r fonts $out/share/fonts/ 47 + cp "${desktopItem}/share/applications/XMind.desktop" $out/share/applications/XMind.desktop 48 + cp ${srcIcon} $out/share/icons/hicolor/scalable/apps/xmind.png 31 49 32 50 patchelf --set-interpreter $(cat ${stdenv.cc}/nix-support/dynamic-linker) \ 33 51 $out/libexec/XMind ··· 35 53 wrapProgram $out/libexec/XMind \ 36 54 --prefix LD_LIBRARY_PATH : "${libPath}" 37 55 38 - substituteInPlace "$out/bin/XMind" \ 39 - --replace '/usr/lib/xmind' "$out/libexec" 56 + # Inspired by https://aur.archlinux.org/cgit/aur.git/tree/?h=xmind 57 + cat >$out/bin/XMind <<EOF 58 + #! ${runtimeShell} 59 + if [ ! -d "\$HOME/.xmind" ]; then 60 + mkdir -p "\$HOME/.xmind/configuration-cathy/" 61 + cp -r $out/libexec/configuration/ \$HOME/.xmind/configuration-cathy/ 62 + fi 63 + 64 + exec "$out/libexec/XMind" "$@" 65 + EOF 66 + chmod +x $out/bin/XMind 40 67 41 68 ln -s ${jre} $out/libexec/jre 42 69 ''; ··· 55 82 GTD. Meanwhile, XMind can read FreeMind and MindManager files, 56 83 and save to Evernote. 57 84 ''; 58 - homepage = http://www.xmind.net/; 85 + homepage = https://www.xmind.net/; 59 86 license = licenses.unfree; 60 87 platforms = platforms.linux; 61 - maintainers = with maintainers; [ michalrus ]; 88 + maintainers = with maintainers; [ michalrus ma27 ]; 62 89 }; 63 90 }
+40
pkgs/applications/misc/xmind/java-env-config-fixes.patch
··· 1 + diff --git a/XMind_amd64/XMind.ini b/XMind_amd64/XMind.ini 2 + index bdd8a37..5f35daf 100644 3 + --- a/XMind_amd64/XMind.ini 4 + +++ b/XMind_amd64/XMind.ini 5 + @@ -1,11 +1,11 @@ 6 + -configuration 7 + -./configuration 8 + +@user.home/.xmind/configuration-cathy_linux_64 9 + -data 10 + -../workspace 11 + +@user.home/.xmind/workspace-cathy 12 + -startup 13 + -../plugins/org.eclipse.equinox.launcher_1.3.200.v20160318-1642.jar 14 + +plugins/org.eclipse.equinox.launcher_1.3.200.v20160318-1642.jar 15 + --launcher.library 16 + -../plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.400.v20160518-1444 17 + +plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.400.v20160518-1444 18 + --launcher.defaultAction 19 + openFile 20 + --launcher.GTK_version 21 + diff --git a/XMind_i386/XMind.ini b/XMind_i386/XMind.ini 22 + index 4ed3225..1d74258 100644 23 + --- a/XMind_i386/XMind.ini 24 + +++ b/XMind_i386/XMind.ini 25 + @@ -1,11 +1,11 @@ 26 + -configuration 27 + -./configuration 28 + +@user.home/.xmind/configuration-cathy_linux_64 29 + -data 30 + -../workspace 31 + +@user.home/.xmind/workspace-cathy 32 + -startup 33 + -../plugins/org.eclipse.equinox.launcher_1.3.200.v20160318-1642.jar 34 + +plugins/org.eclipse.equinox.launcher_1.3.200.v20160318-1642.jar 35 + --launcher.library 36 + -../plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.1.400.v20160518-1444 37 + +plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.1.400.v20160518-1444 38 + --launcher.defaultAction 39 + openFile 40 + --launcher.GTK_version