git.iko.soy/typeable/nixpkgs
on master help sign in
calibre: add desktop entry files
2b28811cmfwyp
pkgs/applications/misc/calibre/default.nix+80−3
@@ -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
5}:
5}:
6
6
7stdenv.mkDerivation rec {
7stdenv.mkDerivation rec {
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
9 name = "calibre-${version}";
9 name = "calibre-${version}";
10
10
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";
14 };
14 };
15
15
@@ -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
69 done
69 done
70+
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
76+ done
70 '';
77 '';
71
78
79+ calibreDesktopItem = makeDesktopItem {
80+ name = "calibre";
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"
89+ "text/html"
90+ "application/x-cbc"
91+ "application/ereader"
92+ "application/oebps-package+xml"
93+ "image/vnd.djvu"
94+ "application/x-sony-bbeb"
95+ "application/vnd.ms-word.document.macroenabled.12"
96+ "text/rtf"
97+ "text/x-markdown"
98+ "application/pdf"
99+ "application/x-cbz"
100+ "application/x-mobipocket-ebook"
101+ "application/x-cbr"
102+ "application/x-mobi8-ebook"
103+ "text/fb2+xml"
104+ "application/vnd.oasis.opendocument.text"
105+ "application/epub+zip"
106+ "text/plain"
107+ "application/xhtml+xml"
108+ ];
109+ categories = "Office";
110+ extraEntries = ''
111+ Actions=ebook-edit ebook-viewer
112+
113+ [Desktop Action ebook-edit]
114+ Name=Edit E-book
115+ Icon=@out@/share/calibre/images/tweak.png
116+ Exec=@out@/bin/ebook-edit --detach %F
117+
118+ [Desktop Action ebook-viewer]
119+ Name=E-book Viewer
120+ Icon=@out@/share/calibre/images/viewer.png
121+ Exec=@out@/bin/ebook-viewer --detach %F
122+ '';
123+ };
124+
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";
135+ };
136+
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";
147+ };
148+
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;