about summary refs log tree commit diff
path: root/pkgs/applications/graphics/ocrfeeder/default.nix
blob: d6243bdbffac3ff5389279e930876e3b03cbb104 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
{ lib, stdenv
, fetchurl
, pkg-config
, wrapGAppsHook
, intltool
, itstool
, libxml2
, gobject-introspection
, gtk3
, goocanvas2
, gtkspell3
, isocodes
, gnome
, python3
, tesseract4
, extraOcrEngines ? [] # other supported engines are: ocrad gocr cuneiform
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "ocrfeeder";
  version = "0.8.5";

  src = fetchurl {
    url = "mirror://gnome/sources/${finalAttrs.pname}/${lib.versions.majorMinor finalAttrs.version}/${finalAttrs.pname}-${finalAttrs.version}.tar.xz";
    sha256 = "sha256-sD0qWUndguJzTw0uy0FIqupFf4OX6dTFvcd+Mz+8Su0=";
  };

  nativeBuildInputs = [
    pkg-config
    wrapGAppsHook
    intltool
    itstool
    libxml2
    gobject-introspection
  ];

  buildInputs = [
    gtk3
    goocanvas2
    gtkspell3
    isocodes
    (python3.withPackages(ps: with ps; [
      pyenchant
      sane
      pillow
      reportlab
      odfpy
      pygobject3
    ]))
  ];
  patches = [
    # Compiles, but doesn't launch without this, see:
    # https://gitlab.gnome.org/GNOME/ocrfeeder/-/issues/83
    ./fix-launch.diff
  ];

  enginesPath = lib.makeBinPath ([
    tesseract4
  ] ++ extraOcrEngines);

  preFixup = ''
    gappsWrapperArgs+=(--prefix PATH : "${finalAttrs.enginesPath}")
    gappsWrapperArgs+=(--set ISO_CODES_DIR "${isocodes}/share/xml/iso-codes")
  '';

  meta = with lib; {
    homepage = "https://gitlab.gnome.org/GNOME/ocrfeeder";
    description = "Complete Optical Character Recognition and Document Analysis and Recognition program";
    maintainers = with maintainers; [ doronbehar ];
    license = licenses.gpl3Plus;
    platforms = platforms.linux;
  };
})