@@ -1,7 +1,7 @@
1{ stdenv, fetchurl, python, pyqt5, sip_4_16, poppler_utils, pkgconfig, libpng
1{ stdenv, fetchurl, python, pyqt5, sip_4_16, poppler_utils, pkgconfig, libpng
2, imagemagick, libjpeg, fontconfig, podofo, qtbase, qmakeHook, icu, sqlite
2, imagemagick, libjpeg, fontconfig, podofo, qtbase, qmakeHook, icu, sqlite
3, makeWrapper, unrarSupport ? false, chmlib, pythonPackages, xz, libusb1, libmtp
3, makeWrapper, unrarSupport ? false, chmlib, pythonPackages, xz, libusb1, libmtp
4−, xdg_utils
4+, xdg_utils, makeDesktopItem
7stdenv.mkDerivation rec {
7stdenv.mkDerivation rec {
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
9 name = "calibre-${version}";
9 name = "calibre-${version}";
11 src = fetchurl {
11 src = fetchurl {
12− url = "http://download.calibre-ebook.com/${version}/${name}.tar.xz";
12+ url = "https://download.calibre-ebook.com/${version}/${name}.tar.xz";
13 sha256 = "0npqvfjqj1vwa7nmnsyd4d30z40brydw275ldf1jankrp6dr9dyd";
13 sha256 = "0npqvfjqj1vwa7nmnsyd4d30z40brydw275ldf1jankrp6dr9dyd";
@@ -67,11 +67,88 @@ stdenv.mkDerivation rec {
67 wrapProgram $a --prefix PYTHONPATH : $PYTHONPATH \
67 wrapProgram $a --prefix PYTHONPATH : $PYTHONPATH \
68 --prefix PATH : ${poppler_utils.out}/bin
68 --prefix PATH : ${poppler_utils.out}/bin
71+ # Replace @out@ by the output path.
72+ mkdir -p $out/share/applications/
73+ cp {$calibreDesktopItem,$ebookEditDesktopItem,$ebookViewerDesktopItem}/share/applications/* $out/share/applications/
74+ for entry in $out/share/applications/*.desktop; do
75+ substituteAllInPlace $entry
79+ calibreDesktopItem = makeDesktopItem {
81+ desktopName = "calibre";
82+ exec = "@out@/bin/calibre --detach %F";
83+ genericName = "E-book library management";
84+ icon = "@out@/share/calibre/images/library.png";
85+ comment = "Manage, convert, edit, and read e-books";
86+ mimeType = stdenv.lib.concatStringsSep ";" [
87+ "application/x-mobipocket-subscription"
88+ "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
91+ "application/ereader"
92+ "application/oebps-package+xml"
94+ "application/x-sony-bbeb"
95+ "application/vnd.ms-word.document.macroenabled.12"
100+ "application/x-mobipocket-ebook"
102+ "application/x-mobi8-ebook"
104+ "application/vnd.oasis.opendocument.text"
105+ "application/epub+zip"
107+ "application/xhtml+xml"
109+ categories = "Office";
111+ Actions=ebook-edit ebook-viewer
113+ [Desktop Action ebook-edit]
115+ Icon=@out@/share/calibre/images/tweak.png
116+ Exec=@out@/bin/ebook-edit --detach %F
118+ [Desktop Action ebook-viewer]
120+ Icon=@out@/share/calibre/images/viewer.png
121+ Exec=@out@/bin/ebook-viewer --detach %F
125+ ebookEditDesktopItem = makeDesktopItem {
126+ name = "calibre-edit-ebook";
127+ desktopName = "Edit E-book";
128+ genericName = "E-book Editor";
129+ comment = "Edit e-books";
130+ icon = "@out@/share/calibre/images/tweak.png";
131+ exec = "@out@/bin/ebook-edit --detach %F";
132+ categories = "Office;Publishing";
133+ mimeType = "application/epub+zip";
134+ extraEntries = "NoDisplay=true";
137+ ebookViewerDesktopItem = makeDesktopItem {
138+ name = "calibre-ebook-viewer";
139+ desktopName = "E-book Viewer";
140+ genericName = "E-book Viewer";
141+ comment = "Read e-books in all the major formats";
142+ icon = "@out@/share/calibre/images/viewer.png";
143+ exec = "@out@/bin/ebook-viewer --detach %F";
144+ categories = "Office;Viewer";
145+ mimeType = "application/epub+zip";
146+ extraEntries = "NoDisplay=true";
72 meta = with stdenv.lib; {
149 meta = with stdenv.lib; {
73 description = "Comprehensive e-book software";
150 description = "Comprehensive e-book software";
74− homepage = http://calibre-ebook.com;
151+ homepage = https://calibre-ebook.com;
75 license = with licenses; if unrarSupport then unfreeRedistributable else gpl3;
152 license = with licenses; if unrarSupport then unfreeRedistributable else gpl3;
76 maintainers = with maintainers; [ viric domenkozar pSub AndersonTorres ];
153 maintainers = with maintainers; [ viric domenkozar pSub AndersonTorres ];
77 platforms = platforms.linux;
154 platforms = platforms.linux;