mendeley: 1.19.5 -> 2.80.1

+22 -126
+22 -126
pkgs/applications/office/mendeley/default.nix
··· 1 - { fetchurl, lib, stdenv, mkDerivation, dpkg, which 2 - , makeWrapper 3 - , alsa-lib 4 - , desktop-file-utils 5 - , dbus 6 - , libcap 7 - , fontconfig 8 - , freetype 9 - , gcc 1 + { lib 2 + , fetchurl 3 + , appimageTools 10 4 , gconf 11 - , glib 12 - , icu 13 - , libxml2 14 - , libxslt 15 - , orc 16 - , nss 17 - , nspr 18 - , qtbase 19 - , qtsvg 20 - , qtdeclarative 21 - , qtwebchannel 22 - , qtquickcontrols 23 - , qtwebkit 24 - , qtwebengine 25 - , sqlite 26 - , xorg 27 - , zlib 28 - # The provided wrapper does this, but since we don't use it 29 - # we emulate the behavior. The downside is that this 30 - # will leave entries on your system after uninstalling mendeley. 31 - # (they can be removed by running '$out/bin/install-mendeley-link-handler.sh -u') 32 - , autorunLinkHandler ? true 33 - # Update script 34 - , writeScript 35 - , runtimeShell 5 + , imagemagick 36 6 }: 37 7 38 8 let 39 - arch32 = "i686-linux"; 40 - 41 - arch = if stdenv.hostPlatform.system == arch32 42 - then "i386" 43 - else "amd64"; 44 - 45 - shortVersion = "1.19.5-stable"; 46 - 47 - version = "${shortVersion}_${arch}"; 48 - 49 - url = "http://desktop-download.mendeley.com/download/apt/pool/main/m/mendeleydesktop/mendeleydesktop_${version}.deb"; 50 - sha256 = if stdenv.hostPlatform.system == arch32 51 - then "01x83a44qlxi937b128y8y0px0q4w37g72z652lc42kv50dhyy3f" 52 - else "1cagqq0xziznaj97z30bqfhrwjv3a4h83ckhwigq35nhk1ggq1ry"; 53 - 54 - deps = [ 55 - qtbase 56 - qtsvg 57 - qtdeclarative 58 - qtwebchannel 59 - qtquickcontrols 60 - qtwebkit 61 - qtwebengine 62 - alsa-lib 63 - dbus 64 - freetype 65 - fontconfig 66 - gcc.cc 67 - gconf 68 - glib 69 - icu 70 - libcap 71 - libxml2 72 - libxslt 73 - nspr 74 - nss 75 - orc 76 - sqlite 77 - xorg.libX11 78 - xorg.xcbutilkeysyms 79 - xorg.libxcb 80 - xorg.libXcomposite 81 - xorg.libXext 82 - xorg.libXrender 83 - xorg.libXi 84 - xorg.libXcursor 85 - xorg.libXtst 86 - xorg.libXrandr 87 - xorg.xcbutilimage 88 - zlib 89 - ]; 9 + name = "mendeley"; 10 + version = "2.80.1"; 90 11 91 - in 92 - 93 - mkDerivation { 94 - pname = "mendeley"; 95 - inherit version; 12 + executableName = "${name}-reference-manager"; 96 13 97 14 src = fetchurl { 98 - url = url; 99 - sha256 = sha256; 15 + url = "https://static.mendeley.com/bin/desktop/mendeley-reference-manager-2.80.1-x86_64.AppImage"; 16 + sha256 = "sha256-uqmu7Yf4tXDlNGkeEZut4m339S6ZNKhAmej+epKLB/8="; 100 17 }; 101 18 102 - nativeBuildInputs = [ makeWrapper ]; 103 - buildInputs = [ dpkg which ] ++ deps; 104 - 105 - propagatedUserEnvPkgs = [ gconf ]; 106 - 107 - dontUnpack = true; 108 - 109 - dontWrapQtApps = true; 110 - 111 - installPhase = '' 112 - dpkg-deb -x $src $out 113 - mv $out/opt/mendeleydesktop/{bin,lib,share} $out 19 + appimageContents = appimageTools.extractType2 { 20 + inherit name src; 21 + }; 22 + in appimageTools.wrapType2 rec { 23 + inherit name src; 114 24 115 - interpreter=$(patchelf --print-interpreter $(readlink -f $(which patchelf))) 116 - patchelf --set-interpreter $interpreter \ 117 - --set-rpath ${lib.makeLibraryPath deps}:$out/lib \ 118 - $out/bin/mendeleydesktop 25 + extraInstallCommands = '' 26 + mv $out/bin/${name} $out/bin/${executableName} 27 + install -m 444 -D ${appimageContents}/${executableName}.desktop $out/share/applications/${executableName}.desktop 28 + ${imagemagick}/bin/convert ${appimageContents}/${executableName}.png -resize 512x512 ${name}_512.png 29 + install -m 444 -D ${name}_512.png $out/share/icons/hicolor/512x512/apps/${executableName}.png 119 30 120 - wrapQtApp $out/bin/mendeleydesktop \ 121 - --add-flags "--unix-distro-build" \ 122 - ${lib.optionalString autorunLinkHandler # ignore errors installing the link handler 123 - ''--run "$out/bin/install-mendeley-link-handler.sh $out/bin/mendeleydesktop ||:"''} 124 - 125 - # Remove bundled qt bits 126 - rm -rf $out/lib/qt 127 - rm $out/bin/qt* $out/bin/Qt* 128 - 129 - # Patch up link handler script 130 - wrapProgram $out/bin/install-mendeley-link-handler.sh \ 131 - --prefix PATH ':' ${lib.makeBinPath [ which gconf desktop-file-utils ] } 31 + substituteInPlace $out/share/applications/${executableName}.desktop \ 32 + --replace 'Exec=AppRun' 'Exec=${executableName}' 132 33 ''; 133 34 134 - dontStrip = true; 135 - dontPatchELF = true; 136 - 137 - updateScript = import ./update.nix { inherit writeScript runtimeShell; }; 138 - 139 35 meta = with lib; { 140 36 homepage = "https://www.mendeley.com"; 141 37 description = "A reference manager and academic social network"; 142 38 sourceProvenance = with sourceTypes; [ binaryNativeCode ]; 143 39 license = licenses.unfree; 144 - platforms = [ "x86_64-linux" "i686-linux" ]; 40 + platforms = [ "x86_64-linux" ]; 145 41 maintainers = with maintainers; [ dtzWill ]; 146 42 }; 147 43