From 12021c78369619667aa76ce6d767e4015e2aa548 Mon Sep 17 00:00:00 2001 From: wrvsrx Date: Sat, 22 Jun 2024 11:12:33 +0800 Subject: [PATCH 1/3] calibre: remove `removeReferencesTo` since it makes no difference for calibre now --- pkgs/applications/misc/calibre/default.nix | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/pkgs/applications/misc/calibre/default.nix b/pkgs/applications/misc/calibre/default.nix index 0e19d1597365..0001bdabe9b1 100644 --- a/pkgs/applications/misc/calibre/default.nix +++ b/pkgs/applications/misc/calibre/default.nix @@ -21,7 +21,6 @@ , qmake , qtbase , qtwayland -, removeReferencesTo , speechd , sqlite , wrapQtAppsHook @@ -69,7 +68,6 @@ stdenv.mkDerivation (finalAttrs: { cmake pkg-config qmake - removeReferencesTo wrapGAppsHook3 wrapQtAppsHook ]; @@ -173,13 +171,7 @@ stdenv.mkDerivation (finalAttrs: { dontWrapQtApps = true; dontWrapGApps = true; - # Remove some references to shrink the closure size. This reference (as of - # 2018-11-06) was a single string like the following: - # /nix/store/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-podofo-0.9.6-dev/include/podofo/base/PdfVariant.h preFixup = '' - remove-references-to -t ${podofo.dev} \ - $out/lib/calibre/calibre/plugins/podofo.so - for program in $out/bin/*; do wrapProgram $program \ ''${qtWrapperArgs[@]} \ @@ -189,8 +181,6 @@ stdenv.mkDerivation (finalAttrs: { done ''; - disallowedReferences = [ podofo.dev ]; - meta = { homepage = "https://calibre-ebook.com"; description = "Comprehensive e-book software"; From 53e0568ae8f4182ae24130c43cace4782b9ae21f Mon Sep 17 00:00:00 2001 From: wrvsrx Date: Sat, 22 Jun 2024 11:30:13 +0800 Subject: [PATCH 2/3] calibre: add `popplerSupport` and `speechSupport` args --- pkgs/applications/misc/calibre/default.nix | 27 +++++++++++++--------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/pkgs/applications/misc/calibre/default.nix b/pkgs/applications/misc/calibre/default.nix index 0001bdabe9b1..0126b0fc2517 100644 --- a/pkgs/applications/misc/calibre/default.nix +++ b/pkgs/applications/misc/calibre/default.nix @@ -26,6 +26,8 @@ , wrapQtAppsHook , xdg-utils , wrapGAppsHook3 +, popplerSupport ? true +, speechSupport ? true , unrarSupport ? false }: @@ -117,7 +119,6 @@ stdenv.mkDerivation (finalAttrs: { regex sip setuptools - speechd zeroconf jeepney pycryptodome @@ -130,7 +131,7 @@ stdenv.mkDerivation (finalAttrs: { # does not support by simply omitting qtwebengine. pyqt6-webengine ] ++ lib.optional (unrarSupport) unrardll - ); + ) ++ lib.optional (speechSupport) speechd; installPhase = '' runHook preInstall @@ -171,15 +172,19 @@ stdenv.mkDerivation (finalAttrs: { dontWrapQtApps = true; dontWrapGApps = true; - preFixup = '' - for program in $out/bin/*; do - wrapProgram $program \ - ''${qtWrapperArgs[@]} \ - ''${gappsWrapperArgs[@]} \ - --prefix PYTHONPATH : $PYTHONPATH \ - --prefix PATH : ${poppler_utils.out}/bin - done - ''; + preFixup = + let + popplerArgs = "--prefix PATH : ${poppler_utils.out}/bin"; + in + '' + for program in $out/bin/*; do + wrapProgram $program \ + ''${qtWrapperArgs[@]} \ + ''${gappsWrapperArgs[@]} \ + --prefix PYTHONPATH : $PYTHONPATH \ + ${if popplerSupport then popplerArgs else ""} + done + ''; meta = { homepage = "https://calibre-ebook.com"; From e5e058dce36f37139983e78b58e827d1550d5934 Mon Sep 17 00:00:00 2001 From: wrvsrx Date: Sat, 29 Jun 2024 15:08:45 +0800 Subject: [PATCH 3/3] calibre: avoid wrap PYTHONPATH --- pkgs/applications/misc/calibre/default.nix | 84 +++++++++++----------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/pkgs/applications/misc/calibre/default.nix b/pkgs/applications/misc/calibre/default.nix index 0126b0fc2517..e1bf6cffb008 100644 --- a/pkgs/applications/misc/calibre/default.nix +++ b/pkgs/applications/misc/calibre/default.nix @@ -91,47 +91,48 @@ stdenv.mkDerivation (finalAttrs: { qtbase qtwayland sqlite + (python3Packages.python.withPackages + (ps: with ps; [ + (apsw.overrideAttrs (oldAttrs: { + setupPyBuildFlags = [ "--enable=load_extension" ]; + })) + beautifulsoup4 + css-parser + cssselect + python-dateutil + dnspython + faust-cchardet + feedparser + html2text + html5-parser + lxml + markdown + mechanize + msgpack + netifaces + pillow + pychm + pyqt-builder + pyqt6 + python + regex + sip + setuptools + zeroconf + jeepney + pycryptodome + xxhash + # the following are distributed with calibre, but we use upstream instead + odfpy + ] ++ lib.optionals (lib.lists.any (p: p == stdenv.hostPlatform.system) pyqt6-webengine.meta.platforms) [ + # much of calibre's functionality is usable without a web + # browser, so we enable building on platforms which qtwebengine + # does not support by simply omitting qtwebengine. + pyqt6-webengine + ] ++ lib.optional (unrarSupport) unrardll) + ) xdg-utils - ] ++ ( - with python3Packages; [ - (apsw.overrideAttrs (oldAttrs: { - setupPyBuildFlags = [ "--enable=load_extension" ]; - })) - beautifulsoup4 - css-parser - cssselect - python-dateutil - dnspython - faust-cchardet - feedparser - html2text - html5-parser - lxml - markdown - mechanize - msgpack - netifaces - pillow - pychm - pyqt-builder - pyqt6 - python - regex - sip - setuptools - zeroconf - jeepney - pycryptodome - xxhash - # the following are distributed with calibre, but we use upstream instead - odfpy - ] ++ lib.optionals (lib.lists.any (p: p == stdenv.hostPlatform.system) pyqt6-webengine.meta.platforms) [ - # much of calibre's functionality is usable without a web - # browser, so we enable building on platforms which qtwebengine - # does not support by simply omitting qtwebengine. - pyqt6-webengine - ] ++ lib.optional (unrarSupport) unrardll - ) ++ lib.optional (speechSupport) speechd; + ] ++ lib.optional (speechSupport) speechd; installPhase = '' runHook preInstall @@ -148,7 +149,7 @@ stdenv.mkDerivation (finalAttrs: { export XDG_DATA_HOME=$out/share export XDG_UTILS_INSTALL_MODE="user" - ${python3Packages.python.pythonOnBuildForHost.interpreter} setup.py install --root=$out \ + python setup.py install --root=$out \ --prefix=$out \ --libdir=$out/lib \ --staging-root=$out \ @@ -181,7 +182,6 @@ stdenv.mkDerivation (finalAttrs: { wrapProgram $program \ ''${qtWrapperArgs[@]} \ ''${gappsWrapperArgs[@]} \ - --prefix PYTHONPATH : $PYTHONPATH \ ${if popplerSupport then popplerArgs else ""} done '';