From ca598e048b5c54eda2015e8db0d28604e80b8ca3 Mon Sep 17 00:00:00 2001 From: AtilaSaraiva Date: Tue, 13 Dec 2022 13:55:58 -0700 Subject: [PATCH 1/2] mendeley: 1.19.5 -> 2.80.1 --- pkgs/applications/office/mendeley/default.nix | 148 +++--------------- 1 file changed, 22 insertions(+), 126 deletions(-) diff --git a/pkgs/applications/office/mendeley/default.nix b/pkgs/applications/office/mendeley/default.nix index e204e04008ca..01cd0956b728 100644 --- a/pkgs/applications/office/mendeley/default.nix +++ b/pkgs/applications/office/mendeley/default.nix @@ -1,147 +1,43 @@ -{ fetchurl, lib, stdenv, mkDerivation, dpkg, which -, makeWrapper -, alsa-lib -, desktop-file-utils -, dbus -, libcap -, fontconfig -, freetype -, gcc +{ lib +, fetchurl +, appimageTools , gconf -, glib -, icu -, libxml2 -, libxslt -, orc -, nss -, nspr -, qtbase -, qtsvg -, qtdeclarative -, qtwebchannel -, qtquickcontrols -, qtwebkit -, qtwebengine -, sqlite -, xorg -, zlib -# The provided wrapper does this, but since we don't use it -# we emulate the behavior. The downside is that this -# will leave entries on your system after uninstalling mendeley. -# (they can be removed by running '$out/bin/install-mendeley-link-handler.sh -u') -, autorunLinkHandler ? true -# Update script -, writeScript -, runtimeShell +, imagemagick }: let - arch32 = "i686-linux"; + name = "mendeley"; + version = "2.80.1"; - arch = if stdenv.hostPlatform.system == arch32 - then "i386" - else "amd64"; - - shortVersion = "1.19.5-stable"; - - version = "${shortVersion}_${arch}"; - - url = "http://desktop-download.mendeley.com/download/apt/pool/main/m/mendeleydesktop/mendeleydesktop_${version}.deb"; - sha256 = if stdenv.hostPlatform.system == arch32 - then "01x83a44qlxi937b128y8y0px0q4w37g72z652lc42kv50dhyy3f" - else "1cagqq0xziznaj97z30bqfhrwjv3a4h83ckhwigq35nhk1ggq1ry"; - - deps = [ - qtbase - qtsvg - qtdeclarative - qtwebchannel - qtquickcontrols - qtwebkit - qtwebengine - alsa-lib - dbus - freetype - fontconfig - gcc.cc - gconf - glib - icu - libcap - libxml2 - libxslt - nspr - nss - orc - sqlite - xorg.libX11 - xorg.xcbutilkeysyms - xorg.libxcb - xorg.libXcomposite - xorg.libXext - xorg.libXrender - xorg.libXi - xorg.libXcursor - xorg.libXtst - xorg.libXrandr - xorg.xcbutilimage - zlib - ]; - -in - -mkDerivation { - pname = "mendeley"; - inherit version; + executableName = "${name}-reference-manager"; src = fetchurl { - url = url; - sha256 = sha256; + url = "https://static.mendeley.com/bin/desktop/mendeley-reference-manager-2.80.1-x86_64.AppImage"; + sha256 = "sha256-uqmu7Yf4tXDlNGkeEZut4m339S6ZNKhAmej+epKLB/8="; }; - nativeBuildInputs = [ makeWrapper ]; - buildInputs = [ dpkg which ] ++ deps; + appimageContents = appimageTools.extractType2 { + inherit name src; + }; +in appimageTools.wrapType2 rec { + inherit name src; - propagatedUserEnvPkgs = [ gconf ]; + extraInstallCommands = '' + mv $out/bin/${name} $out/bin/${executableName} + install -m 444 -D ${appimageContents}/${executableName}.desktop $out/share/applications/${executableName}.desktop + ${imagemagick}/bin/convert ${appimageContents}/${executableName}.png -resize 512x512 ${name}_512.png + install -m 444 -D ${name}_512.png $out/share/icons/hicolor/512x512/apps/${executableName}.png - dontUnpack = true; - - dontWrapQtApps = true; - - installPhase = '' - dpkg-deb -x $src $out - mv $out/opt/mendeleydesktop/{bin,lib,share} $out - - interpreter=$(patchelf --print-interpreter $(readlink -f $(which patchelf))) - patchelf --set-interpreter $interpreter \ - --set-rpath ${lib.makeLibraryPath deps}:$out/lib \ - $out/bin/mendeleydesktop - - wrapQtApp $out/bin/mendeleydesktop \ - --add-flags "--unix-distro-build" \ - ${lib.optionalString autorunLinkHandler # ignore errors installing the link handler - ''--run "$out/bin/install-mendeley-link-handler.sh $out/bin/mendeleydesktop ||:"''} - - # Remove bundled qt bits - rm -rf $out/lib/qt - rm $out/bin/qt* $out/bin/Qt* - - # Patch up link handler script - wrapProgram $out/bin/install-mendeley-link-handler.sh \ - --prefix PATH ':' ${lib.makeBinPath [ which gconf desktop-file-utils ] } + substituteInPlace $out/share/applications/${executableName}.desktop \ + --replace 'Exec=AppRun' 'Exec=${executableName}' ''; - dontStrip = true; - dontPatchELF = true; - - updateScript = import ./update.nix { inherit writeScript runtimeShell; }; - meta = with lib; { homepage = "https://www.mendeley.com"; description = "A reference manager and academic social network"; sourceProvenance = with sourceTypes; [ binaryNativeCode ]; license = licenses.unfree; - platforms = [ "x86_64-linux" "i686-linux" ]; + platforms = [ "x86_64-linux" ]; maintainers = with maintainers; [ dtzWill ]; }; From 31243a31c5b3c0cfed3cf1a878f480ced246ba63 Mon Sep 17 00:00:00 2001 From: AtilaSaraiva Date: Tue, 13 Dec 2022 13:56:36 -0700 Subject: [PATCH 2/2] mendeley: added atila to maintainers --- pkgs/applications/office/mendeley/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/applications/office/mendeley/default.nix b/pkgs/applications/office/mendeley/default.nix index 01cd0956b728..fc3b7216b7a2 100644 --- a/pkgs/applications/office/mendeley/default.nix +++ b/pkgs/applications/office/mendeley/default.nix @@ -38,7 +38,7 @@ in appimageTools.wrapType2 rec { sourceProvenance = with sourceTypes; [ binaryNativeCode ]; license = licenses.unfree; platforms = [ "x86_64-linux" ]; - maintainers = with maintainers; [ dtzWill ]; + maintainers = with maintainers; [ dtzWill atila ]; }; }