nixpkgs/pkgs/applications/office/mendeley/default.nix

148 lines
3.1 KiB
Nix
Raw Normal View History

2019-11-13 09:55:06 +01:00
{ fetchurl, stdenv, mkDerivation, dpkg, which
2017-05-17 21:26:11 +02:00
, makeWrapper
, alsaLib
, desktop-file-utils
, dbus
, libcap
, fontconfig
, freetype
, gcc
, 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
}:
2015-01-24 22:40:01 +01:00
let
arch32 = "i686-linux";
arch = if stdenv.hostPlatform.system == arch32
2015-01-24 22:40:01 +01:00
then "i386"
else "amd64";
2019-05-09 00:02:01 +02:00
shortVersion = "1.19.5-stable";
2015-01-24 22:40:01 +01:00
version = "${shortVersion}_${arch}";
url = "http://desktop-download.mendeley.com/download/apt/pool/main/m/mendeleydesktop/mendeleydesktop_${version}.deb";
sha256 = if stdenv.hostPlatform.system == arch32
2019-05-09 00:02:01 +02:00
then "01x83a44qlxi937b128y8y0px0q4w37g72z652lc42kv50dhyy3f"
else "1cagqq0xziznaj97z30bqfhrwjv3a4h83ckhwigq35nhk1ggq1ry";
2015-01-24 22:40:01 +01:00
deps = [
qtbase
qtsvg
qtdeclarative
qtwebchannel
qtquickcontrols
qtwebkit
qtwebengine
alsaLib
dbus
freetype
fontconfig
gcc.cc
gconf
glib
icu
libcap
libxml2
libxslt
nspr
nss
orc
sqlite
xorg.libX11
2018-03-13 11:16:03 +01:00
xorg.xcbutilkeysyms
xorg.libxcb
xorg.libXcomposite
xorg.libXext
xorg.libXrender
xorg.libXi
xorg.libXcursor
xorg.libXtst
xorg.libXrandr
xorg.xcbutilimage
2015-01-24 22:40:01 +01:00
zlib
];
in
2019-11-13 09:55:06 +01:00
mkDerivation {
2019-08-13 23:52:01 +02:00
pname = "mendeley";
inherit version;
2015-01-24 22:40:01 +01:00
src = fetchurl {
url = url;
sha256 = sha256;
};
2017-05-17 21:26:11 +02:00
nativeBuildInputs = [ makeWrapper ];
buildInputs = [ dpkg which ] ++ deps;
2015-01-24 22:40:01 +01:00
propagatedUserEnvPkgs = [ gconf ];
2019-06-19 17:45:34 +02:00
dontUnpack = true;
2015-01-24 22:40:01 +01:00
2019-11-14 01:03:45 +01:00
dontWrapQtApps = true;
2015-01-24 22:40:01 +01:00
installPhase = ''
dpkg-deb -x $src $out
mv $out/opt/mendeleydesktop/{bin,lib,share} $out
2015-01-24 22:40:01 +01:00
interpreter=$(patchelf --print-interpreter $(readlink -f $(which patchelf)))
patchelf --set-interpreter $interpreter \
--set-rpath ${stdenv.lib.makeLibraryPath deps}:$out/lib \
$out/bin/mendeleydesktop
2019-11-14 01:03:45 +01:00
wrapQtApp $out/bin/mendeleydesktop \
--add-flags "--unix-distro-build" \
${stdenv.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 ':' ${stdenv.lib.makeBinPath [ which gconf desktop-file-utils ] }
2015-01-24 22:40:01 +01:00
'';
dontStrip = true;
dontPatchELF = true;
2015-01-24 22:40:01 +01:00
updateScript = import ./update.nix { inherit writeScript runtimeShell; };
meta = with stdenv.lib; {
homepage = https://www.mendeley.com;
2015-01-25 18:08:01 +01:00
description = "A reference manager and academic social network";
license = licenses.unfree;
platforms = [ "x86_64-linux" "i686-linux" ];
maintainers = with maintainers; [ dtzWill ];
2015-01-24 22:40:01 +01:00
};
}