2015-09-15 10:26:18 +01:00
|
|
|
{ stdenv, fetchurl, bash, firefox, perl, unzipNLS, xorg }:
|
2014-12-04 15:35:48 +00:00
|
|
|
|
2014-03-26 23:24:20 +00:00
|
|
|
let
|
2015-01-24 19:42:19 +00:00
|
|
|
|
|
|
|
xpi = fetchurl {
|
|
|
|
url = "https://download.zotero.org/extension/zotero-${version}.xpi";
|
2015-02-22 00:38:32 +00:00
|
|
|
sha256 = "15wdbwnaxs748psjnxw40wld45npjjmvwx70c0jx2p63y6ks2gcx";
|
2014-12-14 19:47:11 +00:00
|
|
|
};
|
|
|
|
|
2015-02-22 00:38:32 +00:00
|
|
|
version = "4.0.26";
|
2015-01-24 19:42:19 +00:00
|
|
|
|
2014-03-26 23:24:20 +00:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
name = "zotero-${version}";
|
2015-01-24 19:42:19 +00:00
|
|
|
inherit version;
|
2014-03-26 23:24:20 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2015-01-24 19:42:19 +00:00
|
|
|
url = "https://github.com/zotero/zotero-standalone-build/archive/${version}.tar.gz";
|
2015-02-22 00:38:32 +00:00
|
|
|
sha256 = "11gbislxkhfycnii05v6d8h9qdp5rk5xag7kdnsih67gicnn467g";
|
2014-03-26 23:24:20 +00:00
|
|
|
};
|
|
|
|
|
2015-01-24 19:42:19 +00:00
|
|
|
nativeBuildInputs = [ perl unzipNLS ];
|
2014-03-26 23:24:20 +00:00
|
|
|
|
2014-12-14 19:47:11 +00:00
|
|
|
inherit bash firefox;
|
2015-01-24 19:42:19 +00:00
|
|
|
|
|
|
|
phases = "unpackPhase installPhase fixupPhase";
|
|
|
|
|
2014-03-26 23:24:20 +00:00
|
|
|
installPhase = ''
|
2014-06-30 13:56:10 +01:00
|
|
|
mkdir -p "$out/libexec/zotero"
|
2015-01-24 19:42:19 +00:00
|
|
|
unzip "${xpi}" -d "$out/libexec/zotero"
|
|
|
|
|
|
|
|
BUILDID=`date +%Y%m%d`
|
|
|
|
GECKO_VERSION="${firefox.passthru.version}"
|
|
|
|
UPDATE_CHANNEL="default"
|
|
|
|
|
|
|
|
# Copy branding
|
|
|
|
cp -R assets/branding "$out/libexec/zotero/chrome/branding"
|
|
|
|
|
|
|
|
# Adjust chrome.manifest
|
|
|
|
echo "" >> "$out/libexec/zotero/chrome.manifest"
|
|
|
|
cat assets/chrome.manifest >> "$out/libexec/zotero/chrome.manifest"
|
|
|
|
|
|
|
|
# Copy updater.ini
|
|
|
|
cp assets/updater.ini "$out/libexec/zotero"
|
|
|
|
|
|
|
|
# Adjust connector pref
|
|
|
|
perl -pi -e 's/pref\("extensions\.zotero\.httpServer\.enabled", false\);/pref("extensions.zotero.httpServer.enabled", true);/g' "$out/libexec/zotero/defaults/preferences/zotero.js"
|
|
|
|
perl -pi -e 's/pref\("extensions\.zotero\.connector\.enabled", false\);/pref("extensions.zotero.connector.enabled", true);/g' "$out/libexec/zotero/defaults/preferences/zotero.js"
|
|
|
|
|
|
|
|
# Copy icons
|
|
|
|
cp -r assets/icons "$out/libexec/zotero/chrome/icons"
|
|
|
|
|
|
|
|
# Copy application.ini and modify
|
|
|
|
cp assets/application.ini "$out/libexec/zotero/application.ini"
|
|
|
|
perl -pi -e "s/{{VERSION}}/$version/" "$out/libexec/zotero/application.ini"
|
|
|
|
perl -pi -e "s/{{BUILDID}}/$BUILDID/" "$out/libexec/zotero/application.ini"
|
|
|
|
perl -pi -e "s/^MaxVersion.*\$/MaxVersion=$GECKO_VERSION/" "$out/libexec/zotero/application.ini"
|
|
|
|
|
|
|
|
# Copy prefs.js and modify
|
|
|
|
cp assets/prefs.js "$out/libexec/zotero/defaults/preferences"
|
|
|
|
perl -pi -e 's/pref\("app\.update\.channel", "[^"]*"\);/pref\("app\.update\.channel", "'"$UPDATE_CHANNEL"'");/' "$out/libexec/zotero/defaults/preferences/prefs.js"
|
|
|
|
perl -pi -e 's/%GECKO_VERSION%/'"$GECKO_VERSION"'/g' "$out/libexec/zotero/defaults/preferences/prefs.js"
|
|
|
|
|
|
|
|
# Add platform-specific standalone assets
|
|
|
|
cp -R assets/unix "$out/libexec/zotero"
|
2014-03-26 23:24:20 +00:00
|
|
|
|
2014-06-30 13:56:10 +01:00
|
|
|
mkdir -p "$out/bin"
|
2014-03-26 23:24:20 +00:00
|
|
|
substituteAll "${./zotero.sh}" "$out/bin/zotero"
|
|
|
|
chmod +x "$out/bin/zotero"
|
|
|
|
'';
|
|
|
|
|
2014-08-15 01:03:52 +01:00
|
|
|
doInstallCheck = true;
|
|
|
|
installCheckPhase = "$out/bin/zotero --version";
|
|
|
|
|
2014-03-26 23:24:20 +00:00
|
|
|
meta = with stdenv.lib; {
|
|
|
|
homepage = "https://www.zotero.org";
|
|
|
|
description = "Collect, organize, cite, and share your research sources";
|
|
|
|
license = licenses.agpl3;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
maintainers = with maintainers; [ ttuegel ];
|
|
|
|
};
|
|
|
|
}
|