nixpkgs/pkgs/applications/office/mendeley/default.nix
2015-12-02 12:09:50 +01:00

67 lines
1.6 KiB
Nix

{ fetchurl, stdenv, dpkg, makeWrapper, which
,gcc, xorg, qt4, zlib
, ...}:
assert stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux";
let
arch32 = "i686-linux";
arch64 = "x86_64-linux";
arch = if stdenv.system == arch32
then "i386"
else "amd64";
shortVersion = "1.15.2-stable";
version = "${shortVersion}_${arch}";
url = "http://desktop-download.mendeley.com/download/apt/pool/main/m/mendeleydesktop/mendeleydesktop_${version}.deb";
sha256 = if stdenv.system == arch32
then "64e72b5749ea54f75cb0400732af68d1044037c6233a6bc0ba7a560acd3503cb"
else "cd13e39ad665b243fa5ca04c30cdc4c7da3ddaa259ea1af8fd1ff60f85f4eb25";
deps = [
gcc.cc
qt4
xorg.libX11
zlib
];
in
stdenv.mkDerivation {
name = "mendeley-${version}";
src = fetchurl {
url = url;
sha256 = sha256;
};
buildInputs = [ dpkg makeWrapper which ];
unpackPhase = "true";
installPhase = ''
dpkg-deb -x $src $out
mv $out/opt/mendeleydesktop/{bin,lib,plugins,share} $out
interpreter=$(patchelf --print-interpreter $(readlink -f $(which patchelf)))
patchelf --set-interpreter $interpreter $out/bin/mendeleydesktop
librarypath="${stdenv.lib.makeLibraryPath deps}:$out/lib:$out/lib/qt"
wrapProgram $out/bin/mendeleydesktop --prefix LD_LIBRARY_PATH : "$librarypath"
'';
dontStrip = true;
dontPatchElf = true;
meta = {
homepage = http://www.mendeley.com;
description = "A reference manager and academic social network";
license = stdenv.lib.licenses.unfree;
platforms = stdenv.lib.platforms.linux;
};
}