1{
2 lib,
3 fetchurl,
4 gdk-pixbuf,
5 gobject-introspection,
6 gtk3,
7 mcomix,
8 python312, # TODO: Revert to python3 when upgrading past 3.1.0
9 testers,
10 wrapGAppsHook3,
11
12 # Recommended Dependencies:
13 p7zip,
14 unrar,
15 chardetSupport ? true,
16 pdfSupport ? true,
17 unrarSupport ? false, # unfree software
18}:
19
20python312.pkgs.buildPythonApplication rec {
21 pname = "mcomix";
22 version = "3.1.0";
23 pyproject = true;
24
25 src = fetchurl {
26 url = "mirror://sourceforge/mcomix/mcomix-${version}.tar.gz";
27 hash = "sha256-+Shuun/7w86VKBNamTmCPEJfO76fdKY5+HBvzCi0xCc=";
28 };
29
30 buildInputs = [
31 gtk3
32 gdk-pixbuf
33 ];
34
35 nativeBuildInputs = [
36 gobject-introspection
37 python312.pkgs.setuptools
38 wrapGAppsHook3
39 ];
40
41 propagatedBuildInputs =
42 with python312.pkgs;
43 [
44 pillow
45 pycairo
46 pygobject3
47 ]
48 ++ lib.optionals chardetSupport [ chardet ]
49 ++ lib.optionals pdfSupport [ pymupdf ];
50
51 # No tests included in .tar.gz
52 doCheck = false;
53
54 # Prevent double wrapping
55 dontWrapGApps = true;
56
57 preFixup = ''
58 makeWrapperArgs+=(
59 "''${gappsWrapperArgs[@]}"
60 "--prefix" "PATH" ":" "${lib.makeBinPath ([ p7zip ] ++ lib.optional unrarSupport unrar)}"
61 )
62 '';
63
64 postInstall = ''
65 cp -a share $out/
66 '';
67
68 passthru.tests.version = testers.testVersion {
69 package = mcomix;
70 };
71
72 meta = with lib; {
73 description = "Comic book reader and image viewer";
74 mainProgram = "mcomix";
75 longDescription = ''
76 User-friendly, customizable image viewer, specifically designed to handle
77 comic books and manga supporting a variety of container formats
78 (including CBR, CBZ, CB7, CBT, LHA and PDF)
79 '';
80 homepage = "https://sourceforge.net/projects/mcomix/";
81 license = licenses.gpl2Plus;
82 maintainers = with maintainers; [ thiagokokada ];
83 };
84}