From ce00ee56de4286dec326fbe669337b530fab191b Mon Sep 17 00:00:00 2001 From: Mynacol Date: Sun, 14 Dec 2025 10:59:00 +0000 Subject: [PATCH 01/22] zotero: initial commit for building from source Firefox 115 is needed to match upstream and avoid endless patch failures of zotero. It requires cbindgen 0.26 to compile (Firefox 128 supports cbindgen 0.27+). See https://discuss.haiku-os.org/t/progress-on-porting-firefox/13493/234 --- .../zo/zotero/avoid-xulrunner-fetch.patch | 118 ++++++ pkgs/by-name/zo/zotero/darwin.nix | 33 -- pkgs/by-name/zo/zotero/git-revs.patch | 17 + pkgs/by-name/zo/zotero/linux.nix | 139 ------- pkgs/by-name/zo/zotero/package.nix | 357 +++++++++++++++++- .../tools/rust/cbindgen/default.nix | 52 +++ 6 files changed, 531 insertions(+), 185 deletions(-) create mode 100644 pkgs/by-name/zo/zotero/avoid-xulrunner-fetch.patch delete mode 100644 pkgs/by-name/zo/zotero/darwin.nix create mode 100644 pkgs/by-name/zo/zotero/git-revs.patch delete mode 100644 pkgs/by-name/zo/zotero/linux.nix create mode 100644 pkgs/development/tools/rust/cbindgen/default.nix diff --git a/pkgs/by-name/zo/zotero/avoid-xulrunner-fetch.patch b/pkgs/by-name/zo/zotero/avoid-xulrunner-fetch.patch new file mode 100644 index 000000000000..e17e361d554c --- /dev/null +++ b/pkgs/by-name/zo/zotero/avoid-xulrunner-fetch.patch @@ -0,0 +1,118 @@ +diff --git a/app/scripts/fetch_xulrunner b/app/scripts/fetch_xulrunner +index 0d871782c3..bea85feae9 100755 +--- a/app/scripts/fetch_xulrunner ++++ b/app/scripts/fetch_xulrunner +@@ -422,73 +422,11 @@ cd xulrunner + + if [ $BUILD_MAC == 1 ]; then + GECKO_VERSION="$GECKO_VERSION_MAC" +- DOWNLOAD_URL="https://ftp.mozilla.org/pub/firefox/releases/$GECKO_VERSION" +- rm -rf Firefox.app + +- if [ -e "Firefox $GECKO_VERSION.app.zip" ]; then +- echo "Using Firefox $GECKO_VERSION.app.zip" +- unzip "Firefox $GECKO_VERSION.app.zip" +- else +- curl -o Firefox.dmg "$DOWNLOAD_URL/mac/en-US/Firefox%20$GECKO_VERSION.dmg" +- set +e +- hdiutil detach -quiet /Volumes/Firefox 2>/dev/null +- set -e +- hdiutil attach -quiet Firefox.dmg +- cp -a /Volumes/Firefox/Firefox.app . +- hdiutil detach -quiet /Volumes/Firefox +- fi +- +- # Download custom components (e.g., XUL), as an xz-compressed tarball of the MacOS folder with +- # custom files in it +- echo +- rm -rf MacOS +- if [ -n "$custom_components_hash_mac" ]; then +- if [ -e "Firefox $GECKO_VERSION MacOS.zip" ]; then +- echo "Using Firefox $GECKO_VERSION MacOS.zip" +- unzip "Firefox $GECKO_VERSION MacOS.zip" +- else +- echo "Downloading custom Firefox components" +- echo +- curl -o MacOS.tar.xz "${custom_components_url}mac/$custom_components_hash_mac.tar.xz" +- +- # Verify hash +- if [[ "`uname`" = "Darwin" ]]; then +- shasum=shasum +- else +- shasum=sha256sum +- fi +- echo +- echo "$custom_components_hash_mac MacOS.tar.xz" | $shasum -c - +- echo +- +- tar xvf MacOS.tar.xz +- fi +- echo +- fi +- +- pushd Firefox.app/Contents/Resources ++ pushd firefox + modify_omni mac + popd + +- # Replace "FirefoxCP" with "ZoteroCP" for subprocesses ("Isolated Web Content", "Socket Process", "Web Content", etc.) +- info_plist=Firefox.app/Contents/MacOS/plugin-container.app/Contents/Resources/English.lproj/InfoPlist.strings +- from=$(get_utf16_chars "FirefoxCP") +- to=$(get_utf16_chars "ZoteroCP") +- perl -pi -e "s/$from/$to/" $info_plist +- # Check for UTF-16 "ZoteroCP" +- if ! grep -a -q "Z.o.t.e.r.o.C.P." $info_plist; then +- echo '"ZoteroCP" not found in InfoPlist.strings after replacement' +- exit 1 +- fi +- +- if [ ! -e "Firefox $GECKO_VERSION.app.zip" ]; then +- rm "Firefox.dmg" +- fi +- +- #if [ ! -e "Firefox $GECKO_VERSION MacOS.zip" ]; then +- # rm "MacOS.zip" +- #fi +- echo $("$SCRIPT_DIR/xulrunner_hash" -p m) > hash-mac + fi + + if [ $BUILD_WIN == 1 ]; then +@@ -563,36 +501,9 @@ fi + + if [ $BUILD_LINUX == 1 ]; then + GECKO_VERSION="$GECKO_VERSION_LINUX" +- DOWNLOAD_URL="https://ftp.mozilla.org/pub/firefox/releases/$GECKO_VERSION" +- +- +- # Include 32-bit build if not in CI +- if [[ "${CI:-}" = "1" ]] || [[ "${SKIP_32:-}" = "1" ]]; then +- arches="x86_64" +- else +- arches="i686 x86_64" +- fi +- for arch in $arches; do +- xdir="firefox-$arch" +- rm -rf $xdir +- +- archived_file="firefox-$GECKO_VERSION-$arch.tar.bz2" +- if [ -e "$archived_file" ]; then +- echo "Using $archived_file" +- cp "$archived_file" "firefox-$GECKO_VERSION.tar.bz2" +- else +- curl -O "$DOWNLOAD_URL/linux-$arch/en-US/firefox-$GECKO_VERSION.tar.bz2" +- fi +- +- tar xvf firefox-$GECKO_VERSION.tar.bz2 +- mv firefox firefox-$arch +- +- pushd firefox-$arch +- modify_omni $arch ++ pushd firefox ++ modify_omni linux + popd +- echo $($SCRIPT_DIR/xulrunner_hash -p l) > hash-linux +- rm "firefox-$GECKO_VERSION.tar.bz2" +- done + fi + + echo Done diff --git a/pkgs/by-name/zo/zotero/darwin.nix b/pkgs/by-name/zo/zotero/darwin.nix deleted file mode 100644 index 6f27faac3d3f..000000000000 --- a/pkgs/by-name/zo/zotero/darwin.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ - pname, - version, - meta, - stdenv, - fetchurl, - undmg, -}: - -stdenv.mkDerivation (finalAttrs: { - inherit pname version meta; - - src = fetchurl { - url = "https://download.zotero.org/client/release/${finalAttrs.version}/Zotero-${finalAttrs.version}.dmg"; - hash = "sha256-lDf/jULLQyzxNVGRUKuF2df+FTbJK08z+fFQbVgwjsY="; - }; - sourceRoot = "."; - - nativeBuildInputs = [ undmg ]; - - dontConfigure = true; - dontBuild = true; - dontFixup = true; # breaks notarization - - installPhase = '' - runHook preInstall - - mkdir -p $out/Applications - cp -r Zotero.app $out/Applications - - runHook postInstall - ''; -}) diff --git a/pkgs/by-name/zo/zotero/git-revs.patch b/pkgs/by-name/zo/zotero/git-revs.patch new file mode 100644 index 000000000000..e6a89af707e3 --- /dev/null +++ b/pkgs/by-name/zo/zotero/git-revs.patch @@ -0,0 +1,17 @@ +diff --git a/js-build/build.js b/js-build/build.js +index 5e920db6d8..befe280606 100644 +--- a/js-build/build.js ++++ b/js-build/build.js +@@ -36,9 +36,9 @@ if (require.main === module) { + ...scssFiles.map(scf => getSass(scf, { ignore: ignoreMask }, signatures)), + getSymlinks(symlinks, { nodir: true, ignore: ignoreMask }, signatures), + getSymlinks(symlinkDirs, { ignore: ignoreMask }, signatures), +- getPDFReader(signatures), +- getPDFWorker(signatures), +- getZoteroNoteEditor(signatures) ++ //getPDFReader(signatures), ++ //getPDFWorker(signatures), ++ //getZoteroNoteEditor(signatures) + ]); + + await writeSignatures(signatures); diff --git a/pkgs/by-name/zo/zotero/linux.nix b/pkgs/by-name/zo/zotero/linux.nix deleted file mode 100644 index e192ca642823..000000000000 --- a/pkgs/by-name/zo/zotero/linux.nix +++ /dev/null @@ -1,139 +0,0 @@ -{ - pname, - version, - meta, - lib, - stdenv, - fetchurl, - wrapGAppsHook3, - makeDesktopItem, - atk, - cairo, - dbus-glib, - gdk-pixbuf, - glib, - gtk3, - libGL, - libva, - libxtst, - libxrandr, - libxi, - libxfixes, - libxext, - libxdamage, - libxcursor, - libxcomposite, - libx11, - libxcb, - libgbm, - pango, - pciutils, - alsaSupport ? true, - alsa-lib, - jackSupport ? true, - libjack2, - pulseSupport ? true, - libpulseaudio, - sndioSupport ? true, - sndio, -}: - -stdenv.mkDerivation (finalAttrs: { - inherit pname version meta; - - src = fetchurl { - url = "https://download.zotero.org/client/release/${finalAttrs.version}/Zotero-${finalAttrs.version}_linux-x86_64.tar.bz2"; - hash = "sha256-uV0R0L8EoZt59hMKXFlJ+EhONArPpRbb/tIV+wZKLgY="; - }; - - dontPatchELF = true; - nativeBuildInputs = [ wrapGAppsHook3 ]; - - libPath = - lib.makeLibraryPath ( - [ - atk - cairo - dbus-glib - gdk-pixbuf - glib - gtk3 - libGL - libva - libx11 - libxcomposite - libxcursor - libxdamage - libxext - libxfixes - libxi - libxrandr - libxtst - libxcb - libgbm - pango - pciutils - ] - ++ lib.optional alsaSupport alsa-lib - ++ lib.optional jackSupport libjack2 - ++ lib.optional pulseSupport libpulseaudio - ++ lib.optional sndioSupport sndio - ) - + ":" - + lib.makeSearchPathOutput "lib" "lib" [ stdenv.cc.cc ]; - - desktopItem = makeDesktopItem { - name = "zotero"; - exec = "zotero -url %U"; - icon = "zotero"; - comment = finalAttrs.meta.description; - desktopName = "Zotero"; - genericName = "Reference Management"; - categories = [ - "Office" - "Database" - ]; - startupNotify = true; - mimeTypes = [ - "x-scheme-handler/zotero" - "text/plain" - ]; - }; - - installPhase = '' - runHook preInstall - - # Copy package contents to the output directory - mkdir -p "$prefix/usr/lib/zotero-bin-${finalAttrs.version}" - cp -r * "$prefix/usr/lib/zotero-bin-${finalAttrs.version}" - mkdir -p "$out/bin" - ln -s "$prefix/usr/lib/zotero-bin-${finalAttrs.version}/zotero" "$out/bin/" - - # Install desktop file and icons - mkdir -p $out/share/applications - cp ${finalAttrs.desktopItem}/share/applications/* $out/share/applications/ - for size in 32 64 128; do - install -Dm444 icons/icon''${size}.png \ - $out/share/icons/hicolor/''${size}x''${size}/apps/zotero.png - done - install -Dm444 icons/symbolic.svg \ - $out/share/icons/hicolor/symbolic/apps/zotero-symbolic.svg - - runHook postInstall - ''; - - postFixup = '' - for executable in \ - zotero-bin plugin-container updater vaapitest \ - minidump-analyzer glxtest - do - if [ -e "$out/usr/lib/zotero-bin-${finalAttrs.version}/$executable" ]; then - patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ - "$out/usr/lib/zotero-bin-${finalAttrs.version}/$executable" - fi - done - find . -executable -type f -exec \ - patchelf --set-rpath "$libPath" \ - "$out/usr/lib/zotero-bin-${finalAttrs.version}/{}" \; - ''; -}) diff --git a/pkgs/by-name/zo/zotero/package.nix b/pkgs/by-name/zo/zotero/package.nix index f76a17632fd9..a5913d28df04 100644 --- a/pkgs/by-name/zo/zotero/package.nix +++ b/pkgs/by-name/zo/zotero/package.nix @@ -1,30 +1,361 @@ { lib, stdenv, - callPackage, -}: + fetchurl, + fetchFromGitHub, + buildNpmPackage, + which, + git, + nodejs_20, + nodejs_24, + perl, + python3, + curl, + wget, + zip, + unzip, + xz, + gawk, + rsync, + buildMozillaMach, + python311, + rustPlatform, + cmake, + python3Packages, + + wrapGAppsHook3, + makeDesktopItem, + atk, + cairo, + dbus-glib, + gdk-pixbuf, + glib, + gtk3, + libGL, + libva, + xorg, + libgbm, + pango, + pciutils, + alsaSupport ? true, + alsa-lib, + jackSupport ? true, + libjack2, + pulseSupport ? true, + libpulseaudio, + sndioSupport ? true, + sndio, +}: let + nodejs = nodejs_20; + pname = "zotero"; version = "7.0.30"; + + src = fetchFromGitHub { + owner = "zotero"; + repo = "zotero"; + tag = version; + hash = "sha256-/DDtKtRM5ddNekItHI6wAY1YoJmqSk77Lfubo/I6KxU="; + fetchSubmodules = true; + }; + + pdf-js = buildNpmPackage { + pname = "zotero-pdf-js"; + inherit version; + nodejs = nodejs_24; + src = "${src}/pdf-worker/pdf.js"; + npmDepsHash = "sha256-/me+tZdxChpPw0bsvD1fWqBgZezsN8EhL/pC7wTDuFE="; + prePatch = '' + # Drop unmaintained @jazzer fuzzer, it leads to `prebuild: command not found` and is not needed for builds. + # TODO: use https://gitlab.alpinelinux.org/alpine/aports/-/raw/master/community/zotero/zotero_drop-jazzer.patch?inline=false instead + substituteInPlace package.json \ + --replace-fail '"@jazzer.js/core": "^2.1.0",' "" + ''; + buildPhase = '' + npm exec gulp lib-legacy + npm exec gulp generic-legacy + npm exec gulp minified-legacy + ''; + installPhase = '' + mkdir -p $out + cp -r . $out + ''; + }; + + epub-js = buildNpmPackage { + pname = "zotero-epub-js"; + inherit version nodejs; + src = "${src}/reader/epubjs/epub.js"; + npmDepsHash = "sha256-JYOEDX6SxB4Epwq5PZ5Y+EJO6UGKsOBIm2XIAqOwDO8="; + npmBuildScript = "prepare"; + installPhase = '' + mkdir -p $out + cp -r . $out + ''; + }; + + pdf-reader = buildNpmPackage { + pname = "zotero-pdf-reader"; + inherit version; + nodejs = nodejs_24; + src = "${src}/reader"; + npmDepsHash = "sha256-kD3xA3N0gETKnB1nNl0c7Zkh+3zQEcQtsY7cZBdh8KQ="; + postPatch = '' + rm -rf pdfjs/pdf.js + cp -r ${pdf-js} pdfjs/pdf.js + + rm -rf epubjs/epub.js + cp -r ${epub-js} epubjs/epub.js + chmod -R u+w epubjs/epub.js + + substituteInPlace epubjs/epub.js/package.json \ + --replace-fail '"prepare":' '"prepare_old":' + ''; + installPhase = '' + mkdir -p $out + cp -r . $out + ''; + }; + + pdf-worker = buildNpmPackage { + pname = "zotero-pdf-worker"; + inherit version nodejs; + src = "${src}/pdf-worker"; + npmDepsHash = "sha256-TGuN1fZOClzm6xD2rmn5BAemN4mbyOVaLbSRyMeDIm8="; + nativeBuildInputs = [ + rsync + ]; + postPatch = '' + rm -rf pdf.js + cp -r ${pdf-js} pdf.js + ''; + installPhase = '' + mkdir -p $out + cp -r . $out + ''; + }; + + note-editor = buildNpmPackage { + pname = "zotero-note-editor"; + inherit version nodejs; + src = "${src}/note-editor"; + npmDepsHash = "sha256-9DJNlbyRgiipjrpiXGVFOl5zALJOwLCyw8TRkfwm5Ns="; + makeCacheWritable = true; + installPhase = '' + mkdir -p $out + cp -r . $out + ''; + }; + + rust-cbindgen-026 = rustPlatform.buildRustPackage rec { + pname = "rust-cbindgen"; + version = "0.26.0"; + + src = fetchFromGitHub { + owner = "mozilla"; + repo = "cbindgen"; + rev = "v${version}"; + hash = "sha256-gyNZAuxpeOjuC+Rh9jAyHSBQRRYUlYoIrBKuCFg3Hao="; + }; + + cargoHash = "sha256-Mn6TigV/+zqG5CsjHMDYAN54P6qw4G03g7JuUM7GbPw="; + + #buildInputs = lib.optional stdenv.isDarwin Security; + + nativeCheckInputs = [ + cmake + python3Packages.cython + ]; + + checkFlags = [ + # Disable tests that require rust unstable features + # https://github.com/eqrion/cbindgen/issues/338 + "--skip test_expand" + "--skip test_bitfield" + "--skip lib_default_uses_debug_build" + "--skip lib_explicit_debug_build" + "--skip lib_explicit_release_build" + "--skip bin_explicit_release_build" + "--skip bin_default_uses_debug_build" + "--skip bin_explicit_debug_build" + ] + ++ lib.optionals stdenv.isDarwin [ + # WORKAROUND: test_body fails when using clang + # https://github.com/eqrion/cbindgen/issues/628 + "--skip test_body" + ]; + + meta = { + license = lib.licenses.mpl20; + }; + }; + + firefox-115 = + (buildMozillaMach rec { + pname = "firefox-esr-115"; + version = "115.31.0esr"; + applicationName = "Mozilla Firefox ESR"; + src = fetchurl { + url = "mirror://mozilla/firefox/releases/${version}/source/firefox-${version}.source.tar.xz"; + sha512 = "5a56764be6f3d1a4c9f2ee289ec2f220670ad3b99e9ab83a63e24f5fcd023611af7c9bdb81f9baef0d5fe003576d56cee01cf563f6686905363d4c925e4022e2"; + }; + + meta = { + platforms = lib.platforms.unix; + badPlatforms = lib.platforms.darwin; + broken = stdenv.buildPlatform.is32bit; + # since Firefox 60, build on 32-bit platforms fails with "out of memory". + # not in `badPlatforms` because cross-compilation on 64-bit machine might work. + license = lib.licenses.mpl20; + }; + }).override + { + python3 = python311; + elfhackSupport = false; + rust-cbindgen = rust-cbindgen-026; + }; + +in +buildNpmPackage rec { + inherit + pname + version + src + nodejs + ; + + npmDepsHash = "sha256-qWeUeiwM6sCNovSoaEP3b42VTnCFSWLK9y8qPnWcSTE="; + + nativeBuildInputs = [ + #which + git + nodejs + perl + python3 + curl + wget + zip + unzip + xz + gawk + rsync + ]; + + patches = [ + ./git-revs.patch + ./avoid-xulrunner-fetch.patch + ]; + + postPatch = '' + substituteInPlace app/scripts/dir_build \ + --replace-quiet 'hash=`git -C "$ROOT_DIR" rev-parse --short HEAD`' 'hash="e9281c51fd464246b60eee4b3ba999eb4f67d36f"' + + rm -rf reader + cp -r ${pdf-reader} reader + + rm -rf pdf-worker + cp -r ${pdf-worker} pdf-worker + + rm -rf note-editor + cp -r ${note-editor} note-editor + + patchShebangs --build app/ + ''; + + #preBuild = "app/scripts/check_requirements"; + + buildPhase = '' + runHook preBuild + + npm run build + + # Place firefox files at the right place + mkdir -p app/xulrunner + cp -r ${firefox-115}/lib/firefox/ app/xulrunner/ + chmod -R u+w app/xulrunner/ + + app/scripts/dir_build + + runHook postBuild + ''; + + desktopItem = makeDesktopItem { + name = "zotero"; + exec = "zotero -url %U"; + icon = "zotero"; + comment = meta.description; + desktopName = "Zotero"; + genericName = "Reference Management"; + categories = [ + "Office" + "Database" + ]; + startupNotify = true; + mimeTypes = [ + "x-scheme-handler/zotero" + "text/plain" + ]; + }; + + installPhase = '' + runHook preInstall + + mkdir -p $out/lib/ + cp -r app/staging/*/. $out/lib/ + + runHook postInstall + ''; + + /* + installPhase = '' + runHook preInstall + + # Copy package contents to the output directory + mkdir -p "$prefix/usr/lib/zotero-bin-${version}" + cp -r * "$prefix/usr/lib/zotero-bin-${version}" + mkdir -p "$out/bin" + ln -s "$prefix/usr/lib/zotero-bin-${version}/zotero" "$out/bin/" + + # Install desktop file and icons + mkdir -p $out/share/applications + cp ${desktopItem}/share/applications/* $out/share/applications/ + for size in 32 64 128; do + install -Dm444 icons/icon''${size}.png \ + $out/share/icons/hicolor/''${size}x''${size}/apps/zotero.png + done + install -Dm444 icons/symbolic.svg \ + $out/share/icons/hicolor/symbolic/apps/zotero-symbolic.svg + + runHook postInstall + ''; + + postFixup = '' + for executable in \ + zotero-bin plugin-container updater vaapitest \ + minidump-analyzer glxtest + do + if [ -e "$out/usr/lib/zotero-bin-${version}/$executable" ]; then + patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ + "$out/usr/lib/zotero-bin-${version}/$executable" + fi + done + find . -executable -type f -exec \ + patchelf --set-rpath "$libPath" \ + "$out/usr/lib/zotero-bin-${version}/{}" \; + ''; + */ + meta = { homepage = "https://www.zotero.org"; description = "Collect, organize, cite, and share your research sources"; mainProgram = "zotero"; - sourceProvenance = [ lib.sourceTypes.binaryNativeCode ]; license = lib.licenses.agpl3Only; - platforms = [ - "x86_64-linux" - "x86_64-darwin" - "aarch64-darwin" - ]; + platforms = lib.platforms.all; maintainers = with lib.maintainers; [ atila justanotherariel ]; }; -in -if stdenv.hostPlatform.isDarwin then - callPackage ./darwin.nix { inherit pname version meta; } -else - callPackage ./linux.nix { inherit pname version meta; } +} diff --git a/pkgs/development/tools/rust/cbindgen/default.nix b/pkgs/development/tools/rust/cbindgen/default.nix new file mode 100644 index 000000000000..1e4d755fde0b --- /dev/null +++ b/pkgs/development/tools/rust/cbindgen/default.nix @@ -0,0 +1,52 @@ +{ lib +, stdenv +, fetchFromGitHub +, rustPlatform +, cmake +, python3Packages +, Security +}: + +rustPlatform.buildRustPackage rec { + pname = "rust-cbindgen"; + version = "0.26.0"; + + src = fetchFromGitHub { + owner = "mozilla"; + repo = "cbindgen"; + rev = "v${version}"; + hash = "sha256-gyNZAuxpeOjuC+Rh9jAyHSBQRRYUlYoIrBKuCFg3Hao="; + }; + + cargoHash = "sha256-pdTxhECAZzBx5C01Yx7y/OGwhhAdlEDpqLBdvQcb8bc="; + + buildInputs = lib.optional stdenv.isDarwin Security; + + nativeCheckInputs = [ + cmake + python3Packages.cython + ]; + + checkFlags = [ + # Disable tests that require rust unstable features + # https://github.com/eqrion/cbindgen/issues/338 + "--skip test_expand" + "--skip test_bitfield" + "--skip lib_default_uses_debug_build" + "--skip lib_explicit_debug_build" + "--skip lib_explicit_release_build" + ] ++ lib.optionals stdenv.isDarwin [ + # WORKAROUND: test_body fails when using clang + # https://github.com/eqrion/cbindgen/issues/628 + "--skip test_body" + ]; + + meta = with lib; { + changelog = "https://github.com/mozilla/cbindgen/blob/v${version}/CHANGES"; + description = "Project for generating C bindings from Rust code"; + mainProgram = "cbindgen"; + homepage = "https://github.com/mozilla/cbindgen"; + license = licenses.mpl20; + maintainers = with maintainers; [ hexa ]; + }; +} From 5893fdca25ce124464a168e93905975692adf60a Mon Sep 17 00:00:00 2001 From: Mynacol Date: Wed, 7 Jan 2026 12:35:00 +0000 Subject: [PATCH 02/22] zotero: 7.0.30 -> 8.0-unstable-2026-01-06 This lets us use the already packaged and built Firefox 140 ESR. Many npm-related annoyances/patches were fixed, other new problems were introduced (locale download). --- .../zo/zotero/avoid-xulrunner-fetch.patch | 81 ++++--- pkgs/by-name/zo/zotero/build-fixes.patch | 56 +++++ pkgs/by-name/zo/zotero/git-revs.patch | 22 +- pkgs/by-name/zo/zotero/package.nix | 219 ++++-------------- .../zo/zotero/pdf-reader-locales.patch | 13 ++ .../tools/rust/cbindgen/default.nix | 52 ----- 6 files changed, 180 insertions(+), 263 deletions(-) create mode 100644 pkgs/by-name/zo/zotero/build-fixes.patch create mode 100644 pkgs/by-name/zo/zotero/pdf-reader-locales.patch delete mode 100644 pkgs/development/tools/rust/cbindgen/default.nix diff --git a/pkgs/by-name/zo/zotero/avoid-xulrunner-fetch.patch b/pkgs/by-name/zo/zotero/avoid-xulrunner-fetch.patch index e17e361d554c..a5601bacd2d4 100644 --- a/pkgs/by-name/zo/zotero/avoid-xulrunner-fetch.patch +++ b/pkgs/by-name/zo/zotero/avoid-xulrunner-fetch.patch @@ -1,14 +1,30 @@ diff --git a/app/scripts/fetch_xulrunner b/app/scripts/fetch_xulrunner -index 0d871782c3..bea85feae9 100755 +index 30c3a9073d..fb7c2f367d 100755 --- a/app/scripts/fetch_xulrunner +++ b/app/scripts/fetch_xulrunner -@@ -422,73 +422,11 @@ cd xulrunner +@@ -148,15 +148,6 @@ function modify_omni { + # Continue using app.update.auto in prefs.js on Windows + replace_line 'PER_INSTALLATION_PREFS_PLATFORMS = \["win"\]' 'PER_INSTALLATION_PREFS_PLATFORMS = []' modules/UpdateUtils.sys.mjs + +- # Prompt if major update is available instead of installing automatically on restart +- replace_line 'if \(!updateAuto\) \{' 'if (update.type == "major") { +- LOG("UpdateService:_selectAndInstallUpdate - prompting because it is a major update"); +- AUSTLMY.pingCheckCode(this._pingSuffix, AUSTLMY.CHK_SHOWPROMPT_PREF); +- Services.obs.notifyObservers(update, "update-available", "show-prompt"); +- return; +- } +- if (!updateAuto) {' modules/UpdateService.sys.mjs +- + # Avoid console warning about resource://gre/modules/FxAccountsCommon.js + replace_line 'const logins = this._data.logins;' 'const logins = this._data.logins; if (this._data.logins.length != -1) return;' modules/LoginStore.sys.mjs + +@@ -506,70 +497,9 @@ cd xulrunner if [ $BUILD_MAC == 1 ]; then GECKO_VERSION="$GECKO_VERSION_MAC" - DOWNLOAD_URL="https://ftp.mozilla.org/pub/firefox/releases/$GECKO_VERSION" - rm -rf Firefox.app - +- - if [ -e "Firefox $GECKO_VERSION.app.zip" ]; then - echo "Using Firefox $GECKO_VERSION.app.zip" - unzip "Firefox $GECKO_VERSION.app.zip" @@ -19,6 +35,8 @@ index 0d871782c3..bea85feae9 100755 - set -e - hdiutil attach -quiet Firefox.dmg - cp -a /Volumes/Firefox/Firefox.app . +- # Store local copy of unmodified app +- zip -r "Firefox $GECKO_VERSION.app.zip" Firefox.app - hdiutil detach -quiet /Volumes/Firefox - fi - @@ -37,7 +55,7 @@ index 0d871782c3..bea85feae9 100755 - - # Verify hash - if [[ "`uname`" = "Darwin" ]]; then -- shasum=shasum +- shasum="shasum -a 256" - else - shasum=sha256sum - fi @@ -54,7 +72,7 @@ index 0d871782c3..bea85feae9 100755 + pushd firefox modify_omni mac popd - +- - # Replace "FirefoxCP" with "ZoteroCP" for subprocesses ("Isolated Web Content", "Socket Process", "Web Content", etc.) - info_plist=Firefox.app/Contents/MacOS/plugin-container.app/Contents/Resources/English.lproj/InfoPlist.strings - from=$(get_utf16_chars "FirefoxCP") @@ -66,52 +84,55 @@ index 0d871782c3..bea85feae9 100755 - exit 1 - fi - -- if [ ! -e "Firefox $GECKO_VERSION.app.zip" ]; then -- rm "Firefox.dmg" -- fi +- rm -f Firefox.dmg - -- #if [ ! -e "Firefox $GECKO_VERSION MacOS.zip" ]; then -- # rm "MacOS.zip" -- #fi - echo $("$SCRIPT_DIR/xulrunner_hash" -p m) > hash-mac fi if [ $BUILD_WIN == 1 ]; then -@@ -563,36 +501,9 @@ fi +@@ -709,44 +639,9 @@ if [ $BUILD_WIN == 1 ]; then + fi if [ $BUILD_LINUX == 1 ]; then - GECKO_VERSION="$GECKO_VERSION_LINUX" +- GECKO_VERSION="$GECKO_VERSION_LINUX" - DOWNLOAD_URL="https://ftp.mozilla.org/pub/firefox/releases/$GECKO_VERSION" -- -- -- # Include 32-bit build if not in CI -- if [[ "${CI:-}" = "1" ]] || [[ "${SKIP_32:-}" = "1" ]]; then -- arches="x86_64" +- +- if [[ -n $arch ]]; then +- arch_list=("$arch") - else -- arches="i686 x86_64" +- arch_list=(x86_64 arm64 i686) - fi -- for arch in $arches; do -- xdir="firefox-$arch" +- for arch in "${arch_list[@]}"; do +- xdir="firefox-linux-$arch" - rm -rf $xdir - -- archived_file="firefox-$GECKO_VERSION-$arch.tar.bz2" +- archived_file="firefox-$GECKO_VERSION-$arch.tar.xz" - if [ -e "$archived_file" ]; then - echo "Using $archived_file" -- cp "$archived_file" "firefox-$GECKO_VERSION.tar.bz2" +- cp "$archived_file" "firefox-$GECKO_VERSION.tar.xz" - else -- curl -O "$DOWNLOAD_URL/linux-$arch/en-US/firefox-$GECKO_VERSION.tar.bz2" +- if [ $arch = "arm64" ]; then +- moz_arch=aarch64 +- else +- moz_arch=$arch +- fi +- curl -O "$DOWNLOAD_URL/linux-$moz_arch/en-US/firefox-$GECKO_VERSION.tar.xz" +- # Store local copy of unmodified app +- cp "firefox-$GECKO_VERSION.tar.xz" "$archived_file" - fi - -- tar xvf firefox-$GECKO_VERSION.tar.bz2 -- mv firefox firefox-$arch +- tar xvf firefox-$GECKO_VERSION.tar.xz +- mv firefox $xdir - -- pushd firefox-$arch +- pushd $xdir - modify_omni $arch -+ pushd firefox ++ pushd firefox-linux-x86_64 + modify_omni linux popd -- echo $($SCRIPT_DIR/xulrunner_hash -p l) > hash-linux -- rm "firefox-$GECKO_VERSION.tar.bz2" +- +- rm "firefox-$GECKO_VERSION.tar.xz" +- +- echo "$( $SCRIPT_DIR/xulrunner_hash -p l -a "$arch" )" > "hash-linux-${arch}" - done fi diff --git a/pkgs/by-name/zo/zotero/build-fixes.patch b/pkgs/by-name/zo/zotero/build-fixes.patch new file mode 100644 index 000000000000..0d71d3d446d3 --- /dev/null +++ b/pkgs/by-name/zo/zotero/build-fixes.patch @@ -0,0 +1,56 @@ +diff --git a/app/build.sh b/app/build.sh +index de092bde16..b2d92287a7 100755 +--- a/app/build.sh ++++ b/app/build.sh +@@ -244,7 +244,7 @@ if [ -z "$UPDATE_CHANNEL" ]; then UPDATE_CHANNEL="default"; fi + BUILD_ID=`date +%Y%m%d%H%M%S` + + # Paths to Gecko runtimes +-MAC_RUNTIME_PATH="$CALLDIR/xulrunner/Firefox.app" ++MAC_RUNTIME_PATH="$CALLDIR/xulrunner/firefox" + WIN_RUNTIME_PATH_PREFIX="$CALLDIR/xulrunner/firefox-" + LINUX_RUNTIME_PATH_PREFIX="$CALLDIR/xulrunner/firefox-linux-" + +@@ -272,8 +272,8 @@ cd "$app_dir" + # This works around https://bugzilla.mozilla.org/show_bug.cgi?id=1772900 + set +e + if [ $BUILD_MAC == 1 ]; then +- cp -Rp "$MAC_RUNTIME_PATH"/Contents/Resources/browser/omni "$app_dir" +- unzip -qj "$MAC_RUNTIME_PATH"/Contents/Resources/omni.ja "hyphenation/*" -d "$app_dir"/hyphenation/ ++ cp -Rp "$MAC_RUNTIME_PATH"/browser/omni "$app_dir" ++ unzip -qj "$MAC_RUNTIME_PATH"/omni.ja "hyphenation/*" -d "$app_dir"/hyphenation/ + + elif [[ $BUILD_WIN == 1 ]]; then + # These are non-arch-specific files, so just find a runtime we fetched: +@@ -644,11 +644,6 @@ if [ $BUILD_MAC == 1 ]; then + cp "$MAC_RUNTIME_PATH/../MacOS/XUL" "$CONTENTSDIR/MacOS/" + fi + +- # Use our own updater, because Mozilla's requires updates signed by Mozilla +- cd "$CONTENTSDIR/MacOS" +- check_lfs_file "$CALLDIR/mac/updater.tar.xz" +- tar xf "$CALLDIR/mac/updater.tar.xz" +- + # Modify Info.plist + perl -pi -e "s/\{\{VERSION\}\}/$VERSION/" "$CONTENTSDIR/Info.plist" + perl -pi -e "s/\{\{VERSION_NUMERIC\}\}/$VERSION_NUMERIC/" "$CONTENTSDIR/Info.plist" +@@ -1028,11 +1023,6 @@ if [ $BUILD_LINUX == 1 ]; then + cp "$CALLDIR/linux/zotero.desktop" "$APPDIR" + cp "$CALLDIR/linux/set_launcher_icon" "$APPDIR" + +- # Use our own updater, because Mozilla's requires updates signed by Mozilla +- check_lfs_file "$CALLDIR/linux/updater.tar.xz" +- tar xf "$CALLDIR/linux/updater.tar.xz" --to-stdout updater-$arch > "$APPDIR/updater" +- chmod 755 "$APPDIR/updater" +- + # Copy app files + rsync -a "$base_dir/" "$APPDIR/" + +@@ -1041,6 +1031,7 @@ if [ $BUILD_LINUX == 1 ]; then + cp -RH "$CALLDIR/modules/zotero-libreoffice-integration/install" "$APPDIR/integration/libreoffice" + + # Copy icons ++ mkdir "$APPDIR/icons/" + cp "$CALLDIR/linux/icons/icon32.png" "$APPDIR/icons/" + cp "$CALLDIR/linux/icons/icon64.png" "$APPDIR/icons/" + cp "$CALLDIR/linux/icons/icon128.png" "$APPDIR/icons/" diff --git a/pkgs/by-name/zo/zotero/git-revs.patch b/pkgs/by-name/zo/zotero/git-revs.patch index e6a89af707e3..da77a12c3526 100644 --- a/pkgs/by-name/zo/zotero/git-revs.patch +++ b/pkgs/by-name/zo/zotero/git-revs.patch @@ -1,17 +1,27 @@ +diff --git a/app/scripts/dir_build b/app/scripts/dir_build +index 493288ad47..213b6d45b0 100755 +--- a/app/scripts/dir_build ++++ b/app/scripts/dir_build +@@ -86,7 +86,7 @@ fi + + CHANNEL="source" + +-hash=$(git -C "$ROOT_DIR" rev-parse --short HEAD) ++hash="8c8da79116b97a8221d4ab223c769ce3e0f26332" + + build_dir=$(mktemp -d) + cleanup() { rm -rf "$build_dir"; } diff --git a/js-build/build.js b/js-build/build.js -index 5e920db6d8..befe280606 100644 +index 6b39260812..910b715298 100644 --- a/js-build/build.js +++ b/js-build/build.js -@@ -36,9 +36,9 @@ if (require.main === module) { +@@ -36,9 +36,6 @@ if (require.main === module) { ...scssFiles.map(scf => getSass(scf, { ignore: ignoreMask }, signatures)), getSymlinks(symlinks, { nodir: true, ignore: ignoreMask }, signatures), getSymlinks(symlinkDirs, { ignore: ignoreMask }, signatures), -- getPDFReader(signatures), +- getReader(signatures), - getPDFWorker(signatures), - getZoteroNoteEditor(signatures) -+ //getPDFReader(signatures), -+ //getPDFWorker(signatures), -+ //getZoteroNoteEditor(signatures) ]); await writeSignatures(signatures); diff --git a/pkgs/by-name/zo/zotero/package.nix b/pkgs/by-name/zo/zotero/package.nix index a5913d28df04..645c35369fca 100644 --- a/pkgs/by-name/zo/zotero/package.nix +++ b/pkgs/by-name/zo/zotero/package.nix @@ -1,78 +1,40 @@ { lib, stdenv, - fetchurl, fetchFromGitHub, buildNpmPackage, - - which, - git, nodejs_20, - nodejs_24, perl, python3, - curl, - wget, zip, unzip, xz, gawk, rsync, - buildMozillaMach, - python311, - rustPlatform, - cmake, - python3Packages, - - wrapGAppsHook3, + firefox-esr-140-unwrapped, makeDesktopItem, - atk, - cairo, - dbus-glib, - gdk-pixbuf, - glib, - gtk3, - libGL, - libva, - xorg, - libgbm, - pango, - pciutils, - alsaSupport ? true, - alsa-lib, - jackSupport ? true, - libjack2, - pulseSupport ? true, - libpulseaudio, - sndioSupport ? true, - sndio, + copyDesktopItems, }: let + # note-editor needs nodejs 20. Any newer version fails to build zotero's fork of @benrbray/prosemirror-math during npm install. nodejs = nodejs_20; pname = "zotero"; - version = "7.0.30"; + version = "8.0-unstable-2026-01-06"; src = fetchFromGitHub { owner = "zotero"; repo = "zotero"; - tag = version; - hash = "sha256-/DDtKtRM5ddNekItHI6wAY1YoJmqSk77Lfubo/I6KxU="; + rev = "8c8da79116b97a8221d4ab223c769ce3e0f26332"; + hash = "sha256-I5gaxzgN+mHSLqV3AJmXCLhKHEh2EmEw2/sf+YRURIk="; fetchSubmodules = true; }; pdf-js = buildNpmPackage { pname = "zotero-pdf-js"; - inherit version; - nodejs = nodejs_24; + inherit version nodejs; src = "${src}/pdf-worker/pdf.js"; - npmDepsHash = "sha256-/me+tZdxChpPw0bsvD1fWqBgZezsN8EhL/pC7wTDuFE="; - prePatch = '' - # Drop unmaintained @jazzer fuzzer, it leads to `prebuild: command not found` and is not needed for builds. - # TODO: use https://gitlab.alpinelinux.org/alpine/aports/-/raw/master/community/zotero/zotero_drop-jazzer.patch?inline=false instead - substituteInPlace package.json \ - --replace-fail '"@jazzer.js/core": "^2.1.0",' "" - ''; + npmDepsHash = "sha256-KeYAY6EWBZVd3QucDEDtI6lwtTahCEFBFf2Ebib9HKg="; buildPhase = '' npm exec gulp lib-legacy npm exec gulp generic-legacy @@ -88,8 +50,11 @@ let pname = "zotero-epub-js"; inherit version nodejs; src = "${src}/reader/epubjs/epub.js"; - npmDepsHash = "sha256-JYOEDX6SxB4Epwq5PZ5Y+EJO6UGKsOBIm2XIAqOwDO8="; - npmBuildScript = "prepare"; + npmDepsHash = "sha256-6XY6uczPOpMpRHDQbkQRHKBDDRQ/MXIVepGBx1V+h5Q="; + buildPhase = '' + npm run compile + npm run build + ''; installPhase = '' mkdir -p $out cp -r . $out @@ -98,20 +63,21 @@ let pdf-reader = buildNpmPackage { pname = "zotero-pdf-reader"; - inherit version; - nodejs = nodejs_24; + inherit version nodejs; src = "${src}/reader"; - npmDepsHash = "sha256-kD3xA3N0gETKnB1nNl0c7Zkh+3zQEcQtsY7cZBdh8KQ="; + npmDepsHash = "sha256-p8O2gIF0S7QO0AR9TPPQsWUtRnKnf58zSl3JZN0lnuc="; + patches = [ ./pdf-reader-locales.patch ]; postPatch = '' rm -rf pdfjs/pdf.js cp -r ${pdf-js} pdfjs/pdf.js + chmod -R u+w pdfjs/pdf.js rm -rf epubjs/epub.js cp -r ${epub-js} epubjs/epub.js chmod -R u+w epubjs/epub.js - substituteInPlace epubjs/epub.js/package.json \ - --replace-fail '"prepare":' '"prepare_old":' + mkdir -p locales/en-US/ + cp -r ${src}/chrome/locale/en-US/zotero/* locales/en-US/ ''; installPhase = '' mkdir -p $out @@ -141,82 +107,19 @@ let pname = "zotero-note-editor"; inherit version nodejs; src = "${src}/note-editor"; - npmDepsHash = "sha256-9DJNlbyRgiipjrpiXGVFOl5zALJOwLCyw8TRkfwm5Ns="; + npmDepsHash = "sha256-3KSSm8oCNOIDN/ZHhDbx7+cF20qtjtZwpnCOOWe3WQc="; makeCacheWritable = true; + patches = [ ./pdf-reader-locales.patch ]; + postPatch = '' + mkdir -p locales/en-US/ + cp -r ${src}/chrome/locale/en-US/zotero/* locales/en-US/ + ''; installPhase = '' mkdir -p $out cp -r . $out ''; }; - rust-cbindgen-026 = rustPlatform.buildRustPackage rec { - pname = "rust-cbindgen"; - version = "0.26.0"; - - src = fetchFromGitHub { - owner = "mozilla"; - repo = "cbindgen"; - rev = "v${version}"; - hash = "sha256-gyNZAuxpeOjuC+Rh9jAyHSBQRRYUlYoIrBKuCFg3Hao="; - }; - - cargoHash = "sha256-Mn6TigV/+zqG5CsjHMDYAN54P6qw4G03g7JuUM7GbPw="; - - #buildInputs = lib.optional stdenv.isDarwin Security; - - nativeCheckInputs = [ - cmake - python3Packages.cython - ]; - - checkFlags = [ - # Disable tests that require rust unstable features - # https://github.com/eqrion/cbindgen/issues/338 - "--skip test_expand" - "--skip test_bitfield" - "--skip lib_default_uses_debug_build" - "--skip lib_explicit_debug_build" - "--skip lib_explicit_release_build" - "--skip bin_explicit_release_build" - "--skip bin_default_uses_debug_build" - "--skip bin_explicit_debug_build" - ] - ++ lib.optionals stdenv.isDarwin [ - # WORKAROUND: test_body fails when using clang - # https://github.com/eqrion/cbindgen/issues/628 - "--skip test_body" - ]; - - meta = { - license = lib.licenses.mpl20; - }; - }; - - firefox-115 = - (buildMozillaMach rec { - pname = "firefox-esr-115"; - version = "115.31.0esr"; - applicationName = "Mozilla Firefox ESR"; - src = fetchurl { - url = "mirror://mozilla/firefox/releases/${version}/source/firefox-${version}.source.tar.xz"; - sha512 = "5a56764be6f3d1a4c9f2ee289ec2f220670ad3b99e9ab83a63e24f5fcd023611af7c9bdb81f9baef0d5fe003576d56cee01cf563f6686905363d4c925e4022e2"; - }; - - meta = { - platforms = lib.platforms.unix; - badPlatforms = lib.platforms.darwin; - broken = stdenv.buildPlatform.is32bit; - # since Firefox 60, build on 32-bit platforms fails with "out of memory". - # not in `badPlatforms` because cross-compilation on 64-bit machine might work. - license = lib.licenses.mpl20; - }; - }).override - { - python3 = python311; - elfhackSupport = false; - rust-cbindgen = rust-cbindgen-026; - }; - in buildNpmPackage rec { inherit @@ -226,32 +129,26 @@ buildNpmPackage rec { nodejs ; - npmDepsHash = "sha256-qWeUeiwM6sCNovSoaEP3b42VTnCFSWLK9y8qPnWcSTE="; + npmDepsHash = "sha256-IVaT/O83kCGT7MGsTSblMKfVWeNBIpA9VJIWyikJrpk="; nativeBuildInputs = [ - #which - git - nodejs perl python3 - curl - wget zip unzip xz gawk rsync + copyDesktopItems ]; patches = [ ./git-revs.patch ./avoid-xulrunner-fetch.patch + ./build-fixes.patch ]; postPatch = '' - substituteInPlace app/scripts/dir_build \ - --replace-quiet 'hash=`git -C "$ROOT_DIR" rev-parse --short HEAD`' 'hash="e9281c51fd464246b60eee4b3ba999eb4f67d36f"' - rm -rf reader cp -r ${pdf-reader} reader @@ -271,9 +168,10 @@ buildNpmPackage rec { npm run build - # Place firefox files at the right place - mkdir -p app/xulrunner - cp -r ${firefox-115}/lib/firefox/ app/xulrunner/ + # Place firefox files at the right place. + # The correct firefox version can be found in zotero/app/config.sh at `GECKO_VERSION_LINUX`. + mkdir -p app/xulrunner/firefox-${stdenv.targetPlatform.parsed.kernel.name}-${stdenv.targetPlatform.parsed.cpu.name} + cp -r ${firefox-esr-140-unwrapped}/lib/firefox/. app/xulrunner/firefox-${stdenv.targetPlatform.parsed.kernel.name}-${stdenv.targetPlatform.parsed.cpu.name} chmod -R u+w app/xulrunner/ app/scripts/dir_build @@ -302,57 +200,28 @@ buildNpmPackage rec { installPhase = '' runHook preInstall - mkdir -p $out/lib/ + # Copy package contents + mkdir -p $out/lib/ $out/bin/ cp -r app/staging/*/. $out/lib/ + # Add binary to bin/ + ln -s ../lib/zotero $out/bin/zotero + + # Install icons + for size in 32 64 128; do + install -Dm444 "app/linux/icons/icon$size.png" "$out/share/icons/hicolor/''${size}x$size/apps/zotero.png" + done + install -Dm444 "app/linux/icons/symbolic.svg" "$out/share/icons/hicolor/scalable/apps/zotero-symbolic.svg" + runHook postInstall ''; - /* - installPhase = '' - runHook preInstall - - # Copy package contents to the output directory - mkdir -p "$prefix/usr/lib/zotero-bin-${version}" - cp -r * "$prefix/usr/lib/zotero-bin-${version}" - mkdir -p "$out/bin" - ln -s "$prefix/usr/lib/zotero-bin-${version}/zotero" "$out/bin/" - - # Install desktop file and icons - mkdir -p $out/share/applications - cp ${desktopItem}/share/applications/* $out/share/applications/ - for size in 32 64 128; do - install -Dm444 icons/icon''${size}.png \ - $out/share/icons/hicolor/''${size}x''${size}/apps/zotero.png - done - install -Dm444 icons/symbolic.svg \ - $out/share/icons/hicolor/symbolic/apps/zotero-symbolic.svg - - runHook postInstall - ''; - - postFixup = '' - for executable in \ - zotero-bin plugin-container updater vaapitest \ - minidump-analyzer glxtest - do - if [ -e "$out/usr/lib/zotero-bin-${version}/$executable" ]; then - patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ - "$out/usr/lib/zotero-bin-${version}/$executable" - fi - done - find . -executable -type f -exec \ - patchelf --set-rpath "$libPath" \ - "$out/usr/lib/zotero-bin-${version}/{}" \; - ''; - */ - meta = { homepage = "https://www.zotero.org"; description = "Collect, organize, cite, and share your research sources"; mainProgram = "zotero"; license = lib.licenses.agpl3Only; - platforms = lib.platforms.all; + platforms = firefox-esr-140-unwrapped.meta.platforms; maintainers = with lib.maintainers; [ atila justanotherariel diff --git a/pkgs/by-name/zo/zotero/pdf-reader-locales.patch b/pkgs/by-name/zo/zotero/pdf-reader-locales.patch new file mode 100644 index 000000000000..643ac3388cf1 --- /dev/null +++ b/pkgs/by-name/zo/zotero/pdf-reader-locales.patch @@ -0,0 +1,13 @@ +diff --git a/webpack.zotero-locale-plugin.js b/webpack.zotero-locale-plugin.js +index fb6eb28..e5e040f 100644 +--- a/webpack.zotero-locale-plugin.js ++++ b/webpack.zotero-locale-plugin.js +@@ -52,7 +52,7 @@ class ZoteroLocalePlugin { + } + + // If the commit hash has changed +- if (lastCommitHash !== this.commitHash) { ++ if (false) { + console.log(`Detected commit hash change (was: ${lastCommitHash}, now: ${this.commitHash}). Clearing and downloading locale files...`); + + // Remove and recreate the output directory diff --git a/pkgs/development/tools/rust/cbindgen/default.nix b/pkgs/development/tools/rust/cbindgen/default.nix deleted file mode 100644 index 1e4d755fde0b..000000000000 --- a/pkgs/development/tools/rust/cbindgen/default.nix +++ /dev/null @@ -1,52 +0,0 @@ -{ lib -, stdenv -, fetchFromGitHub -, rustPlatform -, cmake -, python3Packages -, Security -}: - -rustPlatform.buildRustPackage rec { - pname = "rust-cbindgen"; - version = "0.26.0"; - - src = fetchFromGitHub { - owner = "mozilla"; - repo = "cbindgen"; - rev = "v${version}"; - hash = "sha256-gyNZAuxpeOjuC+Rh9jAyHSBQRRYUlYoIrBKuCFg3Hao="; - }; - - cargoHash = "sha256-pdTxhECAZzBx5C01Yx7y/OGwhhAdlEDpqLBdvQcb8bc="; - - buildInputs = lib.optional stdenv.isDarwin Security; - - nativeCheckInputs = [ - cmake - python3Packages.cython - ]; - - checkFlags = [ - # Disable tests that require rust unstable features - # https://github.com/eqrion/cbindgen/issues/338 - "--skip test_expand" - "--skip test_bitfield" - "--skip lib_default_uses_debug_build" - "--skip lib_explicit_debug_build" - "--skip lib_explicit_release_build" - ] ++ lib.optionals stdenv.isDarwin [ - # WORKAROUND: test_body fails when using clang - # https://github.com/eqrion/cbindgen/issues/628 - "--skip test_body" - ]; - - meta = with lib; { - changelog = "https://github.com/mozilla/cbindgen/blob/v${version}/CHANGES"; - description = "Project for generating C bindings from Rust code"; - mainProgram = "cbindgen"; - homepage = "https://github.com/mozilla/cbindgen"; - license = licenses.mpl20; - maintainers = with maintainers; [ hexa ]; - }; -} From de7214e12f05fc5f2a04a6765cfae0d757e42964 Mon Sep 17 00:00:00 2001 From: Mynacol Date: Sun, 11 Jan 2026 16:40:00 +0000 Subject: [PATCH 03/22] zotero: Setup check phase When running the tests, the build phase has to be built with `ZOTERO_TEST` set. Also generously skip tests that fail. --- pkgs/by-name/zo/zotero/package.nix | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/zo/zotero/package.nix b/pkgs/by-name/zo/zotero/package.nix index 645c35369fca..e714109ee265 100644 --- a/pkgs/by-name/zo/zotero/package.nix +++ b/pkgs/by-name/zo/zotero/package.nix @@ -14,6 +14,8 @@ firefox-esr-140-unwrapped, makeDesktopItem, copyDesktopItems, + xvfb-run, + doCheck ? false, }: let # note-editor needs nodejs 20. Any newer version fails to build zotero's fork of @benrbray/prosemirror-math during npm install. @@ -158,7 +160,20 @@ buildNpmPackage rec { rm -rf note-editor cp -r ${note-editor} note-editor - patchShebangs --build app/ + patchShebangs --build app/ test/ + + # Skip some flaky/failing tests + rm test/tests/retractionsTest.js + for test in \ + "should throw error on broken symlink" \ + "should use BrowserDownload for 403 when enforcing file type" \ + "should use BrowserDownload for a JS redirect page" \ + "should keep attachments pane status after changing selection" \ + "should render preview robustly after making dense calls to render and discard" \ + "should discard attachment pane preview after becoming invisible" \ + ; do + sed -i "s|it(\"$test|it.skip(\"$test|" test/tests/*.js + done ''; #preBuild = "app/scripts/check_requirements"; @@ -179,6 +194,18 @@ buildNpmPackage rec { runHook postBuild ''; + inherit doCheck; + # Build with test support if `doCheck` is enabled. + ZOTERO_TEST = doCheck; + + nativeCheckInputs = [ + xvfb-run + ]; + + checkPhase = '' + CI=true xvfb-run test/runtests.sh + ''; + desktopItem = makeDesktopItem { name = "zotero"; exec = "zotero -url %U"; From 845342dee5a83995b032df576828d35435439286 Mon Sep 17 00:00:00 2001 From: Mynacol Date: Fri, 23 Jan 2026 10:04:00 +0000 Subject: [PATCH 04/22] zotero: 8.0-unstable -> 8.0.0 --- pkgs/by-name/zo/zotero/package.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/by-name/zo/zotero/package.nix b/pkgs/by-name/zo/zotero/package.nix index e714109ee265..54bb6e4e67ad 100644 --- a/pkgs/by-name/zo/zotero/package.nix +++ b/pkgs/by-name/zo/zotero/package.nix @@ -22,13 +22,13 @@ let nodejs = nodejs_20; pname = "zotero"; - version = "8.0-unstable-2026-01-06"; + version = "8.0.0"; src = fetchFromGitHub { owner = "zotero"; repo = "zotero"; - rev = "8c8da79116b97a8221d4ab223c769ce3e0f26332"; - hash = "sha256-I5gaxzgN+mHSLqV3AJmXCLhKHEh2EmEw2/sf+YRURIk="; + tag = version; + hash = "sha256-SG5fTsQgtVX8Pmla2W91sETSR1D7ThmnrdUQwycNsPA="; fetchSubmodules = true; }; From 3d8c36c7952ac411cc73f97d53296ae2d1a0e81b Mon Sep 17 00:00:00 2001 From: Mynacol Date: Fri, 23 Jan 2026 11:34:00 +0000 Subject: [PATCH 05/22] zotero: Fix reader availability the js-build/reader.js etc. files also copied the files to another folder. This was missing to make zotero fully functional. Additionally, with `leaveDotGit` and by providing git as dependency, we can avoid explicitly giving a git hash. --- pkgs/by-name/zo/zotero/git-revs.patch | 27 -------------- pkgs/by-name/zo/zotero/js-build-fixes.patch | 39 +++++++++++++++++++++ pkgs/by-name/zo/zotero/package.nix | 10 ++++-- 3 files changed, 47 insertions(+), 29 deletions(-) delete mode 100644 pkgs/by-name/zo/zotero/git-revs.patch create mode 100644 pkgs/by-name/zo/zotero/js-build-fixes.patch diff --git a/pkgs/by-name/zo/zotero/git-revs.patch b/pkgs/by-name/zo/zotero/git-revs.patch deleted file mode 100644 index da77a12c3526..000000000000 --- a/pkgs/by-name/zo/zotero/git-revs.patch +++ /dev/null @@ -1,27 +0,0 @@ -diff --git a/app/scripts/dir_build b/app/scripts/dir_build -index 493288ad47..213b6d45b0 100755 ---- a/app/scripts/dir_build -+++ b/app/scripts/dir_build -@@ -86,7 +86,7 @@ fi - - CHANNEL="source" - --hash=$(git -C "$ROOT_DIR" rev-parse --short HEAD) -+hash="8c8da79116b97a8221d4ab223c769ce3e0f26332" - - build_dir=$(mktemp -d) - cleanup() { rm -rf "$build_dir"; } -diff --git a/js-build/build.js b/js-build/build.js -index 6b39260812..910b715298 100644 ---- a/js-build/build.js -+++ b/js-build/build.js -@@ -36,9 +36,6 @@ if (require.main === module) { - ...scssFiles.map(scf => getSass(scf, { ignore: ignoreMask }, signatures)), - getSymlinks(symlinks, { nodir: true, ignore: ignoreMask }, signatures), - getSymlinks(symlinkDirs, { ignore: ignoreMask }, signatures), -- getReader(signatures), -- getPDFWorker(signatures), -- getZoteroNoteEditor(signatures) - ]); - - await writeSignatures(signatures); diff --git a/pkgs/by-name/zo/zotero/js-build-fixes.patch b/pkgs/by-name/zo/zotero/js-build-fixes.patch new file mode 100644 index 000000000000..56798cb01edc --- /dev/null +++ b/pkgs/by-name/zo/zotero/js-build-fixes.patch @@ -0,0 +1,39 @@ +diff --git a/js-build/note-editor.js b/js-build/note-editor.js +index 1435730342..c58af27eae 100644 +--- a/js-build/note-editor.js ++++ b/js-build/note-editor.js +@@ -37,8 +37,6 @@ async function getZoteroNoteEditor(signatures) { + } + catch (e) { + console.error(e); +- await exec('npm ci', { cwd: modulePath }); +- await exec('npm run build', { cwd: modulePath }); + await fs.copy(path.join(modulePath, 'build', 'zotero'), targetDir); + } + signatures['note-editor'] = { hash }; +diff --git a/js-build/pdf-worker.js b/js-build/pdf-worker.js +index b820304f3a..3053275dde 100644 +--- a/js-build/pdf-worker.js ++++ b/js-build/pdf-worker.js +@@ -34,8 +34,6 @@ async function getPDFWorker(signatures) { + } + catch (e) { + console.error(e); +- await exec('npm ci', { cwd: modulePath }); +- await exec('npm run build', { cwd: modulePath }); + await fs.copy(path.join(modulePath, 'build', 'worker.js'), path.join(targetDir, 'worker.js')); + } + signatures['pdf-worker'] = { hash }; +diff --git a/js-build/reader.js b/js-build/reader.js +index 67a02a3ad2..14834d80a2 100644 +--- a/js-build/reader.js ++++ b/js-build/reader.js +@@ -37,8 +37,6 @@ async function getReader(signatures) { + } + catch (e) { + console.error(e); +- await exec('npm ci', { cwd: modulePath }); +- await exec('npm run build', { cwd: modulePath }); + await fs.copy(path.join(modulePath, 'build', 'zotero'), targetDir); + } + signatures['reader'] = { hash }; diff --git a/pkgs/by-name/zo/zotero/package.nix b/pkgs/by-name/zo/zotero/package.nix index 54bb6e4e67ad..eb58bf2591ad 100644 --- a/pkgs/by-name/zo/zotero/package.nix +++ b/pkgs/by-name/zo/zotero/package.nix @@ -4,6 +4,7 @@ fetchFromGitHub, buildNpmPackage, nodejs_20, + git, perl, python3, zip, @@ -28,8 +29,9 @@ let owner = "zotero"; repo = "zotero"; tag = version; - hash = "sha256-SG5fTsQgtVX8Pmla2W91sETSR1D7ThmnrdUQwycNsPA="; + hash = "sha256-vjGTlb4LM7wjOZqD/VsHXX59EA1f9a3LDz+Mgo4wHb0="; fetchSubmodules = true; + leaveDotGit = true; }; pdf-js = buildNpmPackage { @@ -134,6 +136,7 @@ buildNpmPackage rec { npmDepsHash = "sha256-IVaT/O83kCGT7MGsTSblMKfVWeNBIpA9VJIWyikJrpk="; nativeBuildInputs = [ + git perl python3 zip @@ -145,7 +148,7 @@ buildNpmPackage rec { ]; patches = [ - ./git-revs.patch + ./js-build-fixes.patch ./avoid-xulrunner-fetch.patch ./build-fixes.patch ]; @@ -153,12 +156,15 @@ buildNpmPackage rec { postPatch = '' rm -rf reader cp -r ${pdf-reader} reader + chmod -R u+w reader rm -rf pdf-worker cp -r ${pdf-worker} pdf-worker + chmod -R u+w pdf-worker rm -rf note-editor cp -r ${note-editor} note-editor + chmod -R u+w note-editor patchShebangs --build app/ test/ From f767b3ad8fdc3210808a842793ae6853a027d499 Mon Sep 17 00:00:00 2001 From: Mynacol Date: Fri, 23 Jan 2026 12:59:00 +0000 Subject: [PATCH 06/22] zotero: Fix darwin By placing firefox at the expected place. Also adapt installPhase. --- .../zo/zotero/avoid-xulrunner-fetch.patch | 34 ++++++++--------- pkgs/by-name/zo/zotero/build-fixes.patch | 30 +++------------ pkgs/by-name/zo/zotero/package.nix | 38 +++++++++++++------ 3 files changed, 46 insertions(+), 56 deletions(-) diff --git a/pkgs/by-name/zo/zotero/avoid-xulrunner-fetch.patch b/pkgs/by-name/zo/zotero/avoid-xulrunner-fetch.patch index a5601bacd2d4..b0761e4a8c41 100644 --- a/pkgs/by-name/zo/zotero/avoid-xulrunner-fetch.patch +++ b/pkgs/by-name/zo/zotero/avoid-xulrunner-fetch.patch @@ -1,5 +1,5 @@ diff --git a/app/scripts/fetch_xulrunner b/app/scripts/fetch_xulrunner -index 30c3a9073d..fb7c2f367d 100755 +index 30c3a9073d..aa953744f8 100755 --- a/app/scripts/fetch_xulrunner +++ b/app/scripts/fetch_xulrunner @@ -148,15 +148,6 @@ function modify_omni { @@ -68,8 +68,7 @@ index 30c3a9073d..fb7c2f367d 100755 - echo - fi - -- pushd Firefox.app/Contents/Resources -+ pushd firefox + pushd Firefox.app/Contents/Resources modify_omni mac popd - @@ -90,20 +89,20 @@ index 30c3a9073d..fb7c2f367d 100755 fi if [ $BUILD_WIN == 1 ]; then -@@ -709,44 +639,9 @@ if [ $BUILD_WIN == 1 ]; then +@@ -709,9 +639,6 @@ if [ $BUILD_WIN == 1 ]; then fi if [ $BUILD_LINUX == 1 ]; then - GECKO_VERSION="$GECKO_VERSION_LINUX" - DOWNLOAD_URL="https://ftp.mozilla.org/pub/firefox/releases/$GECKO_VERSION" - -- if [[ -n $arch ]]; then -- arch_list=("$arch") -- else -- arch_list=(x86_64 arm64 i686) -- fi -- for arch in "${arch_list[@]}"; do -- xdir="firefox-linux-$arch" + if [[ -n $arch ]]; then + arch_list=("$arch") + else +@@ -719,33 +646,11 @@ if [ $BUILD_LINUX == 1 ]; then + fi + for arch in "${arch_list[@]}"; do + xdir="firefox-linux-$arch" - rm -rf $xdir - - archived_file="firefox-$GECKO_VERSION-$arch.tar.xz" @@ -123,17 +122,14 @@ index 30c3a9073d..fb7c2f367d 100755 - - tar xvf firefox-$GECKO_VERSION.tar.xz - mv firefox $xdir -- -- pushd $xdir -- modify_omni $arch -+ pushd firefox-linux-x86_64 -+ modify_omni linux + + pushd $xdir + modify_omni $arch popd -- + - rm "firefox-$GECKO_VERSION.tar.xz" - - echo "$( $SCRIPT_DIR/xulrunner_hash -p l -a "$arch" )" > "hash-linux-${arch}" -- done + done fi - echo Done diff --git a/pkgs/by-name/zo/zotero/build-fixes.patch b/pkgs/by-name/zo/zotero/build-fixes.patch index 0d71d3d446d3..2d4a5334a9dd 100644 --- a/pkgs/by-name/zo/zotero/build-fixes.patch +++ b/pkgs/by-name/zo/zotero/build-fixes.patch @@ -1,27 +1,7 @@ diff --git a/app/build.sh b/app/build.sh -index de092bde16..b2d92287a7 100755 +index de092bde16..af6008e25c 100755 --- a/app/build.sh +++ b/app/build.sh -@@ -244,7 +244,7 @@ if [ -z "$UPDATE_CHANNEL" ]; then UPDATE_CHANNEL="default"; fi - BUILD_ID=`date +%Y%m%d%H%M%S` - - # Paths to Gecko runtimes --MAC_RUNTIME_PATH="$CALLDIR/xulrunner/Firefox.app" -+MAC_RUNTIME_PATH="$CALLDIR/xulrunner/firefox" - WIN_RUNTIME_PATH_PREFIX="$CALLDIR/xulrunner/firefox-" - LINUX_RUNTIME_PATH_PREFIX="$CALLDIR/xulrunner/firefox-linux-" - -@@ -272,8 +272,8 @@ cd "$app_dir" - # This works around https://bugzilla.mozilla.org/show_bug.cgi?id=1772900 - set +e - if [ $BUILD_MAC == 1 ]; then -- cp -Rp "$MAC_RUNTIME_PATH"/Contents/Resources/browser/omni "$app_dir" -- unzip -qj "$MAC_RUNTIME_PATH"/Contents/Resources/omni.ja "hyphenation/*" -d "$app_dir"/hyphenation/ -+ cp -Rp "$MAC_RUNTIME_PATH"/browser/omni "$app_dir" -+ unzip -qj "$MAC_RUNTIME_PATH"/omni.ja "hyphenation/*" -d "$app_dir"/hyphenation/ - - elif [[ $BUILD_WIN == 1 ]]; then - # These are non-arch-specific files, so just find a runtime we fetched: @@ -644,11 +644,6 @@ if [ $BUILD_MAC == 1 ]; then cp "$MAC_RUNTIME_PATH/../MacOS/XUL" "$CONTENTSDIR/MacOS/" fi @@ -34,18 +14,18 @@ index de092bde16..b2d92287a7 100755 # Modify Info.plist perl -pi -e "s/\{\{VERSION\}\}/$VERSION/" "$CONTENTSDIR/Info.plist" perl -pi -e "s/\{\{VERSION_NUMERIC\}\}/$VERSION_NUMERIC/" "$CONTENTSDIR/Info.plist" -@@ -1028,11 +1023,6 @@ if [ $BUILD_LINUX == 1 ]; then +@@ -1027,11 +1022,6 @@ if [ $BUILD_LINUX == 1 ]; then + # Copy Ubuntu launcher files cp "$CALLDIR/linux/zotero.desktop" "$APPDIR" cp "$CALLDIR/linux/set_launcher_icon" "$APPDIR" - +- - # Use our own updater, because Mozilla's requires updates signed by Mozilla - check_lfs_file "$CALLDIR/linux/updater.tar.xz" - tar xf "$CALLDIR/linux/updater.tar.xz" --to-stdout updater-$arch > "$APPDIR/updater" - chmod 755 "$APPDIR/updater" -- + # Copy app files rsync -a "$base_dir/" "$APPDIR/" - @@ -1041,6 +1031,7 @@ if [ $BUILD_LINUX == 1 ]; then cp -RH "$CALLDIR/modules/zotero-libreoffice-integration/install" "$APPDIR/integration/libreoffice" diff --git a/pkgs/by-name/zo/zotero/package.nix b/pkgs/by-name/zo/zotero/package.nix index eb58bf2591ad..193acf1f22e3 100644 --- a/pkgs/by-name/zo/zotero/package.nix +++ b/pkgs/by-name/zo/zotero/package.nix @@ -191,8 +191,12 @@ buildNpmPackage rec { # Place firefox files at the right place. # The correct firefox version can be found in zotero/app/config.sh at `GECKO_VERSION_LINUX`. - mkdir -p app/xulrunner/firefox-${stdenv.targetPlatform.parsed.kernel.name}-${stdenv.targetPlatform.parsed.cpu.name} - cp -r ${firefox-esr-140-unwrapped}/lib/firefox/. app/xulrunner/firefox-${stdenv.targetPlatform.parsed.kernel.name}-${stdenv.targetPlatform.parsed.cpu.name} + mkdir -p app/xulrunner/ + if ${lib.boolToString stdenv.targetPlatform.isDarwin}; then + cp -r '${firefox-esr-140-unwrapped}/Applications/Firefox ESR.app' app/xulrunner/Firefox.app + else + cp -r '${firefox-esr-140-unwrapped}/lib/firefox' app/xulrunner/firefox-${stdenv.targetPlatform.parsed.kernel.name}-${stdenv.targetPlatform.parsed.cpu.name} + fi chmod -R u+w app/xulrunner/ app/scripts/dir_build @@ -233,18 +237,28 @@ buildNpmPackage rec { installPhase = '' runHook preInstall - # Copy package contents - mkdir -p $out/lib/ $out/bin/ - cp -r app/staging/*/. $out/lib/ + if ${lib.boolToString stdenv.targetPlatform.isDarwin}; then - # Add binary to bin/ - ln -s ../lib/zotero $out/bin/zotero + # Copy package contents + mkdir -p $out/Applications + cp -r app/staging/Zotero.app $out/Applications/ - # Install icons - for size in 32 64 128; do - install -Dm444 "app/linux/icons/icon$size.png" "$out/share/icons/hicolor/''${size}x$size/apps/zotero.png" - done - install -Dm444 "app/linux/icons/symbolic.svg" "$out/share/icons/hicolor/scalable/apps/zotero-symbolic.svg" + else + + # Copy package contents + mkdir -p $out/lib/ $out/bin/ + cp -r app/staging/*/. $out/lib/ + + # Add binary to bin/ + ln -s ../lib/zotero $out/bin/zotero + + # Install icons + for size in 32 64 128; do + install -Dm444 "app/linux/icons/icon$size.png" "$out/share/icons/hicolor/''${size}x$size/apps/zotero.png" + done + install -Dm444 "app/linux/icons/symbolic.svg" "$out/share/icons/hicolor/scalable/apps/zotero-symbolic.svg" + + fi runHook postInstall ''; From 20c8c8b0986da3b2a50964fcafb3591adb182e1f Mon Sep 17 00:00:00 2001 From: Mynacol Date: Fri, 23 Jan 2026 14:51:00 +0000 Subject: [PATCH 07/22] zotero: Cleanups - Always run pre/post phase hooks - Hide some expected errors - Update to nodejs 22 - Some other cleanups --- pkgs/by-name/zo/zotero/build-fixes.patch | 4 +-- pkgs/by-name/zo/zotero/js-build-fixes.patch | 21 ++++++------ pkgs/by-name/zo/zotero/package.nix | 36 ++++++++++++++++++--- 3 files changed, 46 insertions(+), 15 deletions(-) diff --git a/pkgs/by-name/zo/zotero/build-fixes.patch b/pkgs/by-name/zo/zotero/build-fixes.patch index 2d4a5334a9dd..73854217084a 100644 --- a/pkgs/by-name/zo/zotero/build-fixes.patch +++ b/pkgs/by-name/zo/zotero/build-fixes.patch @@ -1,5 +1,5 @@ diff --git a/app/build.sh b/app/build.sh -index de092bde16..af6008e25c 100755 +index de092bde16..2e58b687e7 100755 --- a/app/build.sh +++ b/app/build.sh @@ -644,11 +644,6 @@ if [ $BUILD_MAC == 1 ]; then @@ -30,7 +30,7 @@ index de092bde16..af6008e25c 100755 cp -RH "$CALLDIR/modules/zotero-libreoffice-integration/install" "$APPDIR/integration/libreoffice" # Copy icons -+ mkdir "$APPDIR/icons/" ++ mkdir -p "$APPDIR/icons/" cp "$CALLDIR/linux/icons/icon32.png" "$APPDIR/icons/" cp "$CALLDIR/linux/icons/icon64.png" "$APPDIR/icons/" cp "$CALLDIR/linux/icons/icon128.png" "$APPDIR/icons/" diff --git a/pkgs/by-name/zo/zotero/js-build-fixes.patch b/pkgs/by-name/zo/zotero/js-build-fixes.patch index 56798cb01edc..446a476a0115 100644 --- a/pkgs/by-name/zo/zotero/js-build-fixes.patch +++ b/pkgs/by-name/zo/zotero/js-build-fixes.patch @@ -1,37 +1,40 @@ diff --git a/js-build/note-editor.js b/js-build/note-editor.js -index 1435730342..c58af27eae 100644 +index 1435730342..bfd552f863 100644 --- a/js-build/note-editor.js +++ b/js-build/note-editor.js -@@ -37,8 +37,6 @@ async function getZoteroNoteEditor(signatures) { +@@ -36,9 +36,6 @@ async function getZoteroNoteEditor(signatures) { + await fs.remove(path.join(targetDir, 'zotero')); } catch (e) { - console.error(e); +- console.error(e); - await exec('npm ci', { cwd: modulePath }); - await exec('npm run build', { cwd: modulePath }); await fs.copy(path.join(modulePath, 'build', 'zotero'), targetDir); } signatures['note-editor'] = { hash }; diff --git a/js-build/pdf-worker.js b/js-build/pdf-worker.js -index b820304f3a..3053275dde 100644 +index b820304f3a..aafb6b1ef5 100644 --- a/js-build/pdf-worker.js +++ b/js-build/pdf-worker.js -@@ -34,8 +34,6 @@ async function getPDFWorker(signatures) { +@@ -33,9 +33,6 @@ async function getPDFWorker(signatures) { + ); } catch (e) { - console.error(e); +- console.error(e); - await exec('npm ci', { cwd: modulePath }); - await exec('npm run build', { cwd: modulePath }); await fs.copy(path.join(modulePath, 'build', 'worker.js'), path.join(targetDir, 'worker.js')); } signatures['pdf-worker'] = { hash }; diff --git a/js-build/reader.js b/js-build/reader.js -index 67a02a3ad2..14834d80a2 100644 +index 67a02a3ad2..5de2f3ada8 100644 --- a/js-build/reader.js +++ b/js-build/reader.js -@@ -37,8 +37,6 @@ async function getReader(signatures) { +@@ -36,9 +36,6 @@ async function getReader(signatures) { + await fs.remove(path.join(targetDir, 'zotero')); } catch (e) { - console.error(e); +- console.error(e); - await exec('npm ci', { cwd: modulePath }); - await exec('npm run build', { cwd: modulePath }); await fs.copy(path.join(modulePath, 'build', 'zotero'), targetDir); diff --git a/pkgs/by-name/zo/zotero/package.nix b/pkgs/by-name/zo/zotero/package.nix index 193acf1f22e3..ffe8b1f8b2d1 100644 --- a/pkgs/by-name/zo/zotero/package.nix +++ b/pkgs/by-name/zo/zotero/package.nix @@ -3,7 +3,7 @@ stdenv, fetchFromGitHub, buildNpmPackage, - nodejs_20, + nodejs_22, git, perl, python3, @@ -19,8 +19,8 @@ doCheck ? false, }: let - # note-editor needs nodejs 20. Any newer version fails to build zotero's fork of @benrbray/prosemirror-math during npm install. - nodejs = nodejs_20; + # note-editor needs nodejs 22. Any newer version fails to build zotero's fork of @benrbray/prosemirror-math during npm install. + nodejs = nodejs_22; pname = "zotero"; version = "8.0.0"; @@ -40,13 +40,21 @@ let src = "${src}/pdf-worker/pdf.js"; npmDepsHash = "sha256-KeYAY6EWBZVd3QucDEDtI6lwtTahCEFBFf2Ebib9HKg="; buildPhase = '' + runHook preBuild + npm exec gulp lib-legacy npm exec gulp generic-legacy npm exec gulp minified-legacy + + runHook postBuild ''; installPhase = '' + runHook preInstall + mkdir -p $out cp -r . $out + + runHook postInstall ''; }; @@ -56,12 +64,20 @@ let src = "${src}/reader/epubjs/epub.js"; npmDepsHash = "sha256-6XY6uczPOpMpRHDQbkQRHKBDDRQ/MXIVepGBx1V+h5Q="; buildPhase = '' + runHook preBuild + npm run compile npm run build + + runHook postBuild ''; installPhase = '' + runHook preInstall + mkdir -p $out cp -r . $out + + runHook postInstall ''; }; @@ -84,8 +100,12 @@ let cp -r ${src}/chrome/locale/en-US/zotero/* locales/en-US/ ''; installPhase = '' + runHook preInstall + mkdir -p $out cp -r . $out + + runHook postInstall ''; }; @@ -102,8 +122,12 @@ let cp -r ${pdf-js} pdf.js ''; installPhase = '' + runHook preInstall + mkdir -p $out cp -r . $out + + runHook postInstall ''; }; @@ -119,8 +143,12 @@ let cp -r ${src}/chrome/locale/en-US/zotero/* locales/en-US/ ''; installPhase = '' + runHook preInstall + mkdir -p $out cp -r . $out + + runHook postInstall ''; }; @@ -206,7 +234,7 @@ buildNpmPackage rec { inherit doCheck; # Build with test support if `doCheck` is enabled. - ZOTERO_TEST = doCheck; + env.ZOTERO_TEST = doCheck; nativeCheckInputs = [ xvfb-run From 20ad8f2fd6b0e0a5bf475e2950701ebbffa7ca66 Mon Sep 17 00:00:00 2001 From: Mynacol Date: Fri, 23 Jan 2026 15:57:00 +0000 Subject: [PATCH 08/22] zotero: Don't depend on git The leaveDotGit setting was causing unstable hashes. Instead avoid requiring git and .git folders by stubbing hashes. They are seeming not used besides build-related machinery. --- pkgs/by-name/zo/zotero/avoid-git.patch | 58 ++++++++++++++++++++++++++ pkgs/by-name/zo/zotero/package.nix | 6 +-- 2 files changed, 60 insertions(+), 4 deletions(-) create mode 100644 pkgs/by-name/zo/zotero/avoid-git.patch diff --git a/pkgs/by-name/zo/zotero/avoid-git.patch b/pkgs/by-name/zo/zotero/avoid-git.patch new file mode 100644 index 000000000000..7bfed744434e --- /dev/null +++ b/pkgs/by-name/zo/zotero/avoid-git.patch @@ -0,0 +1,58 @@ +diff --git a/app/scripts/dir_build b/app/scripts/dir_build +index 493288ad47..e357770ced 100755 +--- a/app/scripts/dir_build ++++ b/app/scripts/dir_build +@@ -84,9 +84,9 @@ else + fi + fi + +-CHANNEL="source" ++CHANNEL="release" + +-hash=$(git -C "$ROOT_DIR" rev-parse --short HEAD) ++hash="" + + build_dir=$(mktemp -d) + cleanup() { rm -rf "$build_dir"; } +diff --git a/js-build/note-editor.js b/js-build/note-editor.js +index 1435730342..6eebb10c50 100644 +--- a/js-build/note-editor.js ++++ b/js-build/note-editor.js +@@ -12,8 +12,7 @@ async function getZoteroNoteEditor(signatures) { + + const modulePath = path.join(__dirname, '..', 'note-editor'); + +- const { stdout } = await exec('git rev-parse HEAD', { cwd: modulePath }); +- const hash = stdout.trim(); ++ const hash = ''; + + if (!('note-editor' in signatures) || signatures['note-editor'].hash !== hash) { + const targetDir = path.join(__dirname, '..', 'build', 'resource', 'note-editor'); +diff --git a/js-build/pdf-worker.js b/js-build/pdf-worker.js +index b820304f3a..6bbd0708c9 100644 +--- a/js-build/pdf-worker.js ++++ b/js-build/pdf-worker.js +@@ -12,8 +12,7 @@ async function getPDFWorker(signatures) { + + const modulePath = path.join(__dirname, '..', 'pdf-worker'); + +- const { stdout } = await exec('git rev-parse HEAD', { cwd: modulePath }); +- const hash = stdout.trim(); ++ const hash = ''; + + if (!('pdf-worker' in signatures) || signatures['pdf-worker'].hash !== hash) { + const targetDir = path.join(__dirname, '..', 'build', 'chrome', 'content', 'zotero', 'xpcom', 'pdfWorker'); +diff --git a/js-build/reader.js b/js-build/reader.js +index 67a02a3ad2..2127f680df 100644 +--- a/js-build/reader.js ++++ b/js-build/reader.js +@@ -12,8 +12,7 @@ async function getReader(signatures) { + + const modulePath = path.join(__dirname, '..', 'reader'); + +- const { stdout } = await exec('git rev-parse HEAD', { cwd: modulePath }); +- const hash = stdout.trim(); ++ const hash = ''; + + if (!('reader' in signatures) || signatures['reader'].hash !== hash) { + const targetDir = path.join(__dirname, '..', 'build', 'resource', 'reader'); diff --git a/pkgs/by-name/zo/zotero/package.nix b/pkgs/by-name/zo/zotero/package.nix index ffe8b1f8b2d1..48aac7ce667d 100644 --- a/pkgs/by-name/zo/zotero/package.nix +++ b/pkgs/by-name/zo/zotero/package.nix @@ -4,7 +4,6 @@ fetchFromGitHub, buildNpmPackage, nodejs_22, - git, perl, python3, zip, @@ -29,9 +28,8 @@ let owner = "zotero"; repo = "zotero"; tag = version; - hash = "sha256-vjGTlb4LM7wjOZqD/VsHXX59EA1f9a3LDz+Mgo4wHb0="; + hash = "sha256-SG5fTsQgtVX8Pmla2W91sETSR1D7ThmnrdUQwycNsPA="; fetchSubmodules = true; - leaveDotGit = true; }; pdf-js = buildNpmPackage { @@ -164,7 +162,6 @@ buildNpmPackage rec { npmDepsHash = "sha256-IVaT/O83kCGT7MGsTSblMKfVWeNBIpA9VJIWyikJrpk="; nativeBuildInputs = [ - git perl python3 zip @@ -176,6 +173,7 @@ buildNpmPackage rec { ]; patches = [ + ./avoid-git.patch ./js-build-fixes.patch ./avoid-xulrunner-fetch.patch ./build-fixes.patch From 3d3503f47aed8dd5583bb700b01346051fc3e957 Mon Sep 17 00:00:00 2001 From: Mynacol Date: Fri, 23 Jan 2026 17:24:00 +0000 Subject: [PATCH 09/22] zotero: Fix aarch64-linux build It requires "arm64" instead of "aarch64". --- pkgs/by-name/zo/zotero/package.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/zo/zotero/package.nix b/pkgs/by-name/zo/zotero/package.nix index 48aac7ce667d..246e5fbadeaf 100644 --- a/pkgs/by-name/zo/zotero/package.nix +++ b/pkgs/by-name/zo/zotero/package.nix @@ -221,7 +221,9 @@ buildNpmPackage rec { if ${lib.boolToString stdenv.targetPlatform.isDarwin}; then cp -r '${firefox-esr-140-unwrapped}/Applications/Firefox ESR.app' app/xulrunner/Firefox.app else - cp -r '${firefox-esr-140-unwrapped}/lib/firefox' app/xulrunner/firefox-${stdenv.targetPlatform.parsed.kernel.name}-${stdenv.targetPlatform.parsed.cpu.name} + cp -r '${firefox-esr-140-unwrapped}/lib/firefox' app/xulrunner/firefox-${stdenv.targetPlatform.parsed.kernel.name}-${ + lib.replaceString "aarch64" "arm64" stdenv.targetPlatform.parsed.cpu.name + } fi chmod -R u+w app/xulrunner/ From 035938e39f98820df364bd93217baca4d2245200 Mon Sep 17 00:00:00 2001 From: Mynacol Date: Fri, 23 Jan 2026 18:24:00 +0000 Subject: [PATCH 10/22] zotero: Fix x86_64-darwin build It complains on a build path that only triggers when the channel is not `source`. This commit reverts back to `source`. To avoid issues with the git hash, we just provide a valid hash filled with zeroes. --- pkgs/by-name/zo/zotero/avoid-git.patch | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/pkgs/by-name/zo/zotero/avoid-git.patch b/pkgs/by-name/zo/zotero/avoid-git.patch index 7bfed744434e..f0c6b4ffdeaf 100644 --- a/pkgs/by-name/zo/zotero/avoid-git.patch +++ b/pkgs/by-name/zo/zotero/avoid-git.patch @@ -1,16 +1,13 @@ diff --git a/app/scripts/dir_build b/app/scripts/dir_build -index 493288ad47..e357770ced 100755 +index 493288ad47..ccabb3722b 100755 --- a/app/scripts/dir_build +++ b/app/scripts/dir_build -@@ -84,9 +84,9 @@ else - fi - fi +@@ -86,7 +86,7 @@ fi --CHANNEL="source" -+CHANNEL="release" + CHANNEL="source" -hash=$(git -C "$ROOT_DIR" rev-parse --short HEAD) -+hash="" ++hash="0000000000000000000000000000000000000000" build_dir=$(mktemp -d) cleanup() { rm -rf "$build_dir"; } From 2269809a93ee6e730629fdb601c3fcb49efd63be Mon Sep 17 00:00:00 2001 From: Mynacol Date: Fri, 23 Jan 2026 22:46:00 +0000 Subject: [PATCH 11/22] zotero: Add nix-update-script --- pkgs/by-name/zo/zotero/package.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkgs/by-name/zo/zotero/package.nix b/pkgs/by-name/zo/zotero/package.nix index 246e5fbadeaf..2dce3064cc7e 100644 --- a/pkgs/by-name/zo/zotero/package.nix +++ b/pkgs/by-name/zo/zotero/package.nix @@ -14,6 +14,7 @@ firefox-esr-140-unwrapped, makeDesktopItem, copyDesktopItems, + nix-update-script, xvfb-run, doCheck ? false, }: @@ -291,6 +292,8 @@ buildNpmPackage rec { runHook postInstall ''; + passthru.updateScript = nix-update-script { }; + meta = { homepage = "https://www.zotero.org"; description = "Collect, organize, cite, and share your research sources"; From deba72580588ac0d2c5b0974b8a761f491dddaa2 Mon Sep 17 00:00:00 2001 From: Mynacol Date: Tue, 27 Jan 2026 08:47:00 +0000 Subject: [PATCH 12/22] zotero: Replace rec with finalAttrs --- pkgs/by-name/zo/zotero/package.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/by-name/zo/zotero/package.nix b/pkgs/by-name/zo/zotero/package.nix index 2dce3064cc7e..3dbb4f71c767 100644 --- a/pkgs/by-name/zo/zotero/package.nix +++ b/pkgs/by-name/zo/zotero/package.nix @@ -152,7 +152,7 @@ let }; in -buildNpmPackage rec { +buildNpmPackage (finalAttrs: { inherit pname version @@ -249,7 +249,7 @@ buildNpmPackage rec { name = "zotero"; exec = "zotero -url %U"; icon = "zotero"; - comment = meta.description; + comment = finalAttrs.meta.description; desktopName = "Zotero"; genericName = "Reference Management"; categories = [ @@ -305,4 +305,4 @@ buildNpmPackage rec { justanotherariel ]; }; -} +}) From caf8f437191c159f9b607c71dcd3e8f335084ddb Mon Sep 17 00:00:00 2001 From: Mynacol Date: Tue, 27 Jan 2026 10:02:00 +0000 Subject: [PATCH 13/22] zotero: Add myself as maintainer --- pkgs/by-name/zo/zotero/package.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/by-name/zo/zotero/package.nix b/pkgs/by-name/zo/zotero/package.nix index 3dbb4f71c767..1b87a1daf47c 100644 --- a/pkgs/by-name/zo/zotero/package.nix +++ b/pkgs/by-name/zo/zotero/package.nix @@ -303,6 +303,7 @@ buildNpmPackage (finalAttrs: { maintainers = with lib.maintainers; [ atila justanotherariel + mynacol ]; }; }) From 9a3fce016e3c0ab6798fbd1e3eea6e73cf5a7cec Mon Sep 17 00:00:00 2001 From: Mynacol Date: Wed, 28 Jan 2026 11:46:00 +0000 Subject: [PATCH 14/22] zotero: 8.0.0 -> 8.0.1 --- pkgs/by-name/zo/zotero/package.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/zo/zotero/package.nix b/pkgs/by-name/zo/zotero/package.nix index 1b87a1daf47c..d77bfc2688ca 100644 --- a/pkgs/by-name/zo/zotero/package.nix +++ b/pkgs/by-name/zo/zotero/package.nix @@ -23,13 +23,13 @@ let nodejs = nodejs_22; pname = "zotero"; - version = "8.0.0"; + version = "8.0.1"; src = fetchFromGitHub { owner = "zotero"; repo = "zotero"; tag = version; - hash = "sha256-SG5fTsQgtVX8Pmla2W91sETSR1D7ThmnrdUQwycNsPA="; + hash = "sha256-Rm93Xclspb7cp4tTxr6OegLYf+ndyGz3YCwbf+6uGKM="; fetchSubmodules = true; }; From 0be81806404e46afab01017abdbb38230aa86743 Mon Sep 17 00:00:00 2001 From: Mynacol Date: Fri, 30 Jan 2026 10:13:35 +0100 Subject: [PATCH 15/22] zotero: Improve build script - Use simpler os-dependent parts - Add preCheck and postCheck hooks - Explicitly call the build script in the local directory Co-authored-by: Alex Epelde --- pkgs/by-name/zo/zotero/package.nix | 64 ++++++++++++++++-------------- 1 file changed, 34 insertions(+), 30 deletions(-) diff --git a/pkgs/by-name/zo/zotero/package.nix b/pkgs/by-name/zo/zotero/package.nix index d77bfc2688ca..38df69d24022 100644 --- a/pkgs/by-name/zo/zotero/package.nix +++ b/pkgs/by-name/zo/zotero/package.nix @@ -219,16 +219,19 @@ buildNpmPackage (finalAttrs: { # Place firefox files at the right place. # The correct firefox version can be found in zotero/app/config.sh at `GECKO_VERSION_LINUX`. mkdir -p app/xulrunner/ - if ${lib.boolToString stdenv.targetPlatform.isDarwin}; then - cp -r '${firefox-esr-140-unwrapped}/Applications/Firefox ESR.app' app/xulrunner/Firefox.app - else - cp -r '${firefox-esr-140-unwrapped}/lib/firefox' app/xulrunner/firefox-${stdenv.targetPlatform.parsed.kernel.name}-${ - lib.replaceString "aarch64" "arm64" stdenv.targetPlatform.parsed.cpu.name - } - fi + '' + + lib.optionalString stdenv.targetPlatform.isDarwin '' + cp -r "${firefox-esr-140-unwrapped}/Applications/Firefox ESR.app" app/xulrunner/Firefox.app + '' + + lib.optionalString (!stdenv.targetPlatform.isDarwin) '' + cp -r "${firefox-esr-140-unwrapped}/lib/firefox" "app/xulrunner/firefox-${stdenv.targetPlatform.parsed.kernel.name}-${ + lib.replaceString "aarch64" "arm64" stdenv.targetPlatform.parsed.cpu.name + }" + '' + + '' chmod -R u+w app/xulrunner/ - app/scripts/dir_build + ./app/scripts/dir_build runHook postBuild ''; @@ -242,7 +245,11 @@ buildNpmPackage (finalAttrs: { ]; checkPhase = '' + runHook preCheck + CI=true xvfb-run test/runtests.sh + + runHook postCheck ''; desktopItem = makeDesktopItem { @@ -265,30 +272,27 @@ buildNpmPackage (finalAttrs: { installPhase = '' runHook preInstall + '' + + lib.optionalString stdenv.targetPlatform.isDarwin '' + # Copy package contents + mkdir -p $out/Applications + cp -r app/staging/Zotero.app $out/Applications/ + '' + + lib.optionalString (!stdenv.targetPlatform.isDarwin) '' + # Copy package contents + mkdir -p $out/lib/ + cp -r app/staging/*/. $out/lib/ - if ${lib.boolToString stdenv.targetPlatform.isDarwin}; then - - # Copy package contents - mkdir -p $out/Applications - cp -r app/staging/Zotero.app $out/Applications/ - - else - - # Copy package contents - mkdir -p $out/lib/ $out/bin/ - cp -r app/staging/*/. $out/lib/ - - # Add binary to bin/ - ln -s ../lib/zotero $out/bin/zotero - - # Install icons - for size in 32 64 128; do - install -Dm444 "app/linux/icons/icon$size.png" "$out/share/icons/hicolor/''${size}x$size/apps/zotero.png" - done - install -Dm444 "app/linux/icons/symbolic.svg" "$out/share/icons/hicolor/scalable/apps/zotero-symbolic.svg" - - fi + # Add binary to bin/ + mkdir -p $out/bin/ + ln -s ../lib/zotero $out/bin/zotero + # Install icons + for size in 32 64 128; do install -Dm444 "app/linux/icons/icon''${size}.png" "$out/share/icons/hicolor/''${size}x''${size}/apps/zotero.png" + done + install -Dm444 "app/linux/icons/symbolic.svg" "$out/share/icons/hicolor/scalable/apps/zotero-symbolic.svg" + '' + + '' runHook postInstall ''; From c50276c24324f4797e9c506bf577fb9cbd49595b Mon Sep 17 00:00:00 2001 From: Mynacol Date: Fri, 30 Jan 2026 10:15:38 +0100 Subject: [PATCH 16/22] zotero: Fix empty dropdown menus, missing libpci warnings Co-authored-by: Alex Epelde --- pkgs/by-name/zo/zotero/package.nix | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pkgs/by-name/zo/zotero/package.nix b/pkgs/by-name/zo/zotero/package.nix index 38df69d24022..13a0904db3d4 100644 --- a/pkgs/by-name/zo/zotero/package.nix +++ b/pkgs/by-name/zo/zotero/package.nix @@ -14,6 +14,10 @@ firefox-esr-140-unwrapped, makeDesktopItem, copyDesktopItems, + makeWrapper, + libGL, + pciutils, + wrapGAppsHook4, nix-update-script, xvfb-run, doCheck ? false, @@ -171,6 +175,8 @@ buildNpmPackage (finalAttrs: { gawk rsync copyDesktopItems + makeWrapper + wrapGAppsHook4 ]; patches = [ @@ -296,6 +302,15 @@ buildNpmPackage (finalAttrs: { runHook postInstall ''; + preFixup = lib.optionalString (!stdenv.targetPlatform.isDarwin) '' + gappsWrapperArgs+=(--suffix LD_LIBRARY_PATH : ${ + lib.makeLibraryPath [ + libGL + pciutils + ] + }) + ''; + passthru.updateScript = nix-update-script { }; meta = { From ac3878869f5b98c725221c9a016fde65599ab4c9 Mon Sep 17 00:00:00 2001 From: Mynacol Date: Fri, 30 Jan 2026 14:45:26 +0100 Subject: [PATCH 17/22] zotero: Cleanup build Remove/format some remaining annoyances. Co-authored-by: Alex Epelde --- pkgs/by-name/zo/zotero/package.nix | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkgs/by-name/zo/zotero/package.nix b/pkgs/by-name/zo/zotero/package.nix index 13a0904db3d4..4d9160995f45 100644 --- a/pkgs/by-name/zo/zotero/package.nix +++ b/pkgs/by-name/zo/zotero/package.nix @@ -14,7 +14,6 @@ firefox-esr-140-unwrapped, makeDesktopItem, copyDesktopItems, - makeWrapper, libGL, pciutils, wrapGAppsHook4, @@ -175,7 +174,6 @@ buildNpmPackage (finalAttrs: { gawk rsync copyDesktopItems - makeWrapper wrapGAppsHook4 ]; @@ -215,7 +213,9 @@ buildNpmPackage (finalAttrs: { done ''; - #preBuild = "app/scripts/check_requirements"; + #preBuild = '' + # ./app/scripts/check_requirements + #''; buildPhase = '' runHook preBuild @@ -294,7 +294,8 @@ buildNpmPackage (finalAttrs: { ln -s ../lib/zotero $out/bin/zotero # Install icons - for size in 32 64 128; do install -Dm444 "app/linux/icons/icon''${size}.png" "$out/share/icons/hicolor/''${size}x''${size}/apps/zotero.png" + for size in 32 64 128; do + install -Dm444 "app/linux/icons/icon''${size}.png" "$out/share/icons/hicolor/''${size}x''${size}/apps/zotero.png" done install -Dm444 "app/linux/icons/symbolic.svg" "$out/share/icons/hicolor/scalable/apps/zotero-symbolic.svg" '' From 62a011c7f9f87204b90651a339b0525793775939 Mon Sep 17 00:00:00 2001 From: Mynacol Date: Fri, 30 Jan 2026 14:47:11 +0100 Subject: [PATCH 18/22] zotero: Restrict platforms to linux + darwin The build scripts of Zotero and also our patches only consider mac/darwin and linux systems. Anything else will probably fail to build. --- pkgs/by-name/zo/zotero/package.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/by-name/zo/zotero/package.nix b/pkgs/by-name/zo/zotero/package.nix index 4d9160995f45..42e373fb84b6 100644 --- a/pkgs/by-name/zo/zotero/package.nix +++ b/pkgs/by-name/zo/zotero/package.nix @@ -319,7 +319,7 @@ buildNpmPackage (finalAttrs: { description = "Collect, organize, cite, and share your research sources"; mainProgram = "zotero"; license = lib.licenses.agpl3Only; - platforms = firefox-esr-140-unwrapped.meta.platforms; + platforms = lib.platforms.linux ++ lib.platforms.darwin; maintainers = with lib.maintainers; [ atila justanotherariel From 545d8bcede9dca295b0ea23e3e96ba3aee3f0116 Mon Sep 17 00:00:00 2001 From: Mynacol Date: Fri, 30 Jan 2026 16:04:32 +0100 Subject: [PATCH 19/22] zotero: Fix file chooser > It looks like org.gtk.Settings.FileChooser.gschema.xml is provided by `gtk3` but not `gtk4`. Co-authored-by: locnide <49921473+locnide@users.noreply.github.com> --- pkgs/by-name/zo/zotero/package.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/zo/zotero/package.nix b/pkgs/by-name/zo/zotero/package.nix index 42e373fb84b6..c267d7150e65 100644 --- a/pkgs/by-name/zo/zotero/package.nix +++ b/pkgs/by-name/zo/zotero/package.nix @@ -16,7 +16,7 @@ copyDesktopItems, libGL, pciutils, - wrapGAppsHook4, + wrapGAppsHook3, nix-update-script, xvfb-run, doCheck ? false, @@ -174,7 +174,7 @@ buildNpmPackage (finalAttrs: { gawk rsync copyDesktopItems - wrapGAppsHook4 + wrapGAppsHook3 ]; patches = [ From f39b6cc8bd979b37ae236f08e29e56c6dfe5315e Mon Sep 17 00:00:00 2001 From: Mynacol Date: Tue, 3 Feb 2026 12:47:20 +0100 Subject: [PATCH 20/22] zotero: Remove unused and confusing check_requirements script This script is unused and will report some failures, as we patch out the dependency of e.g. git. As such, no one should use it here. Co-authored-by: Sandro --- pkgs/by-name/zo/zotero/package.nix | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pkgs/by-name/zo/zotero/package.nix b/pkgs/by-name/zo/zotero/package.nix index c267d7150e65..76cfaf681bc6 100644 --- a/pkgs/by-name/zo/zotero/package.nix +++ b/pkgs/by-name/zo/zotero/package.nix @@ -213,10 +213,6 @@ buildNpmPackage (finalAttrs: { done ''; - #preBuild = '' - # ./app/scripts/check_requirements - #''; - buildPhase = '' runHook preBuild From ac6cbaa885293b88761db9d6feaa0dd272fc165a Mon Sep 17 00:00:00 2001 From: Mynacol Date: Tue, 3 Feb 2026 21:27:06 +0100 Subject: [PATCH 21/22] zotero: Actually provide desktop file Co-authored-by: Alex Epelde --- pkgs/by-name/zo/zotero/package.nix | 36 ++++++++++++++++-------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/pkgs/by-name/zo/zotero/package.nix b/pkgs/by-name/zo/zotero/package.nix index 76cfaf681bc6..a61e57b845f3 100644 --- a/pkgs/by-name/zo/zotero/package.nix +++ b/pkgs/by-name/zo/zotero/package.nix @@ -254,23 +254,25 @@ buildNpmPackage (finalAttrs: { runHook postCheck ''; - desktopItem = makeDesktopItem { - name = "zotero"; - exec = "zotero -url %U"; - icon = "zotero"; - comment = finalAttrs.meta.description; - desktopName = "Zotero"; - genericName = "Reference Management"; - categories = [ - "Office" - "Database" - ]; - startupNotify = true; - mimeTypes = [ - "x-scheme-handler/zotero" - "text/plain" - ]; - }; + desktopItems = [ + (makeDesktopItem { + name = "zotero"; + exec = "zotero -url %U"; + icon = "zotero"; + comment = finalAttrs.meta.description; + desktopName = "Zotero"; + genericName = "Reference Management"; + categories = [ + "Office" + "Database" + ]; + startupNotify = true; + mimeTypes = [ + "x-scheme-handler/zotero" + "text/plain" + ]; + }) + ]; installPhase = '' runHook preInstall From fbbca38ddee3337f1e133110ce757d51033988dc Mon Sep 17 00:00:00 2001 From: Mynacol Date: Fri, 6 Feb 2026 12:20:00 +0000 Subject: [PATCH 22/22] zotero: 8.0.1 -> 8.0.2 This time generated with nix-update. I additionally manually tested that no npm deps changed in the subprojects. I'm still not sure if nix-update also automatically updates them. --- pkgs/by-name/zo/zotero/package.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/by-name/zo/zotero/package.nix b/pkgs/by-name/zo/zotero/package.nix index a61e57b845f3..78e8292923fb 100644 --- a/pkgs/by-name/zo/zotero/package.nix +++ b/pkgs/by-name/zo/zotero/package.nix @@ -26,13 +26,13 @@ let nodejs = nodejs_22; pname = "zotero"; - version = "8.0.1"; + version = "8.0.2"; src = fetchFromGitHub { owner = "zotero"; repo = "zotero"; tag = version; - hash = "sha256-Rm93Xclspb7cp4tTxr6OegLYf+ndyGz3YCwbf+6uGKM="; + hash = "sha256-zGcTZjrbFYbE4qJH5g3betnSLCdxYU2nZBOU55HunYU="; fetchSubmodules = true; }; @@ -163,7 +163,7 @@ buildNpmPackage (finalAttrs: { nodejs ; - npmDepsHash = "sha256-IVaT/O83kCGT7MGsTSblMKfVWeNBIpA9VJIWyikJrpk="; + npmDepsHash = "sha256-dtbA1V38u26gqWoN+kW/tnccl6HFX7p8fPAneq+mw6U="; nativeBuildInputs = [ perl