Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 27 additions & 34 deletions pkgs/applications/misc/calibre/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,21 @@
, hyphen
, unrarSupport ? false
, chmlib
, python2Packages
, pythonPackages
, libusb1
, libmtp
, xdg_utils
, makeDesktopItem
, removeReferencesTo
}:

let
pypkgs = python2Packages;

in
mkDerivation rec {
pname = "calibre";
version = "4.22.0";
version = "4.23.0";

src = fetchurl {
url = "https://download.calibre-ebook.com/${version}/${pname}-${version}.tar.xz";
sha256 = "0d0wmd3ijk8px1d662igal4lfmpyzynfzs6ms1bb9nf42mq2pxai";
sha256 = "sha256-Ft5RRzzw4zb5RqVyUaHk9Pu6H4V/F9j8FKoTLn61lRg=";
};

patches = [
Expand All @@ -47,7 +43,7 @@ mkDerivation rec {
] ++ lib.optional (!unrarSupport) ./dont_build_unrar_plugin.patch;

prePatch = ''
sed -i "/pyqt_sip_dir/ s:=.*:= '${pypkgs.pyqt5}/share/sip/PyQt5':" \
sed -i "/pyqt_sip_dir/ s:=.*:= '${pythonPackages.pyqt5}/share/sip/PyQt5':" \
setup/build_environment.py

# Remove unneeded files and libs
Expand All @@ -61,52 +57,49 @@ mkDerivation rec {

nativeBuildInputs = [ pkgconfig qmake removeReferencesTo ];

CALIBRE_PY3_PORT = builtins.toString pypkgs.isPy3k;
CALIBRE_PY3_PORT = builtins.toString pythonPackages.isPy3k;

buildInputs = [
poppler_utils
libpng
chmlib
fontconfig
hunspell
hyphen
icu
imagemagick
libjpeg
fontconfig
libmtp
libpng
libusb1
podofo
poppler_utils
qtbase
chmlib
icu
hunspell
hyphen
sqlite
libusb1
libmtp
xdg_utils
] ++ (
with pypkgs; [
with pythonPackages; [
apsw
cssselect
beautifulsoup4
css-parser
cssselect
dateutil
dnspython
feedparser
html2text
html5-parser
lxml
markdown
mechanize
msgpack
netifaces
pillow
python
pyqt5
sip
regex
msgpack
beautifulsoup4
html2text
pyqtwebengine
python
regex
sip
# the following are distributed with calibre, but we use upstream instead
odfpy
]
) ++ lib.optionals (!pypkgs.isPy3k) (
with pypkgs; [
mechanize
]
);

installPhase = ''
Expand All @@ -121,18 +114,17 @@ mkDerivation rec {
export FC_LIB_DIR=${fontconfig.lib}/lib
export PODOFO_INC_DIR=${podofo.dev}/include/podofo
export PODOFO_LIB_DIR=${podofo.lib}/lib
export SIP_BIN=${pypkgs.sip}/bin/sip
export SIP_BIN=${pythonPackages.sip}/bin/sip
export XDG_DATA_HOME=$out/share
export XDG_UTILS_INSTALL_MODE="user"

${pypkgs.python.interpreter} setup.py install --root=$out \
${pythonPackages.python.interpreter} setup.py install --root=$out \
--prefix=$out \
--libdir=$out/lib \
--staging-root=$out \
--staging-libdir=$out/lib \
--staging-sharedir=$out/share


PYFILES="$out/bin/* $out/lib/calibre/calibre/web/feeds/*.py
$out/lib/calibre/calibre/ebooks/metadata/*.py
$out/lib/calibre/calibre/ebooks/rtf2xml/*.py"
Expand All @@ -154,7 +146,8 @@ mkDerivation rec {
# 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
remove-references-to -t ${podofo.dev} \
$out/lib/calibre/calibre/plugins${lib.optionalString pythonPackages.isPy3k "/3"}/podofo.so

for program in $out/bin/*; do
wrapProgram $program \
Expand Down
6 changes: 5 additions & 1 deletion pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19691,7 +19691,11 @@ in

calculix = callPackage ../applications/science/math/calculix {};

calibre = libsForQt5.callPackage ../applications/misc/calibre { };
calibre-py2 = libsForQt5.callPackage ../applications/misc/calibre { pythonPackages = python2Packages; };

calibre-py3 = libsForQt5.callPackage ../applications/misc/calibre { pythonPackages = python3Packages; };

calibre = self.calibre-py3;

calligra = libsForQt5.callPackage ../applications/office/calligra {
inherit (kdeApplications) akonadi-calendar akonadi-contacts;
Expand Down