about summary refs log tree commit diff
path: root/pkgs/applications/graphics/ocrfeeder
diff options
context:
space:
mode:
authorDoron Behar <doron.behar@gmail.com>2020-12-05 14:14:20 +0200
committerDoron Behar <doron.behar@gmail.com>2020-12-05 14:14:20 +0200
commitcc7ce7611924425b4f269da7a9bc3ca7d3ac8514 (patch)
treec9aca634df260051c55d6c8213249d24d5c424e7 /pkgs/applications/graphics/ocrfeeder
parent5d7ef923cb10e02121b84f8ee98ad891d7f35630 (diff)
ocrfeeder: init at 0.8.3
Diffstat (limited to 'pkgs/applications/graphics/ocrfeeder')
-rw-r--r--pkgs/applications/graphics/ocrfeeder/default.nix73
1 files changed, 73 insertions, 0 deletions
diff --git a/pkgs/applications/graphics/ocrfeeder/default.nix b/pkgs/applications/graphics/ocrfeeder/default.nix
new file mode 100644
index 0000000000000..28fe58183faec
--- /dev/null
+++ b/pkgs/applications/graphics/ocrfeeder/default.nix
@@ -0,0 +1,73 @@
+{ stdenv
+, fetchurl
+, pkg-config
+, gtk3
+, gtkspell3
+, isocodes
+, goocanvas2
+, intltool
+, itstool
+, libxml2
+, gnome3
+, python3
+, gobject-introspection
+, wrapGAppsHook
+, tesseract4
+, extraOcrEngines ? [] # other supported engines are: ocrad gocr cuneiform
+}:
+
+stdenv.mkDerivation rec {
+  pname = "ocrfeeder";
+  version = "0.8.3";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "12f5gnq92ffnd5zaj04df7jrnsdz1zn4zcgpbf5p9qnd21i2y529";
+  };
+
+  nativeBuildInputs = [
+    pkg-config
+    wrapGAppsHook
+    intltool
+    itstool
+    libxml2
+  ];
+
+  buildInputs = [
+    gtk3
+    gobject-introspection
+    goocanvas2
+    gtkspell3
+    isocodes
+    (python3.withPackages(ps: with ps; [
+      pyenchant
+      sane
+      pillow
+      reportlab
+      odfpy
+      pygobject3
+    ]))
+  ];
+
+  # https://gitlab.gnome.org/GNOME/ocrfeeder/-/issues/22
+  postConfigure = ''
+    substituteInPlace src/ocrfeeder/util/constants.py \
+      --replace /usr/share/xml/iso-codes ${isocodes}/share/xml/iso-codes
+  '';
+
+  enginesPath = stdenv.lib.makeBinPath ([
+    tesseract4
+  ] ++ extraOcrEngines);
+
+  preFixup = ''
+    gappsWrapperArgs+=(--prefix PATH : "${enginesPath}")
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = "https://wiki.gnome.org/Apps/OCRFeeder";
+    description = "Complete Optical Character Recognition and Document Analysis and Recognition program";
+    maintainers = with maintainers; [ doronbehar ];
+    license = licenses.gpl3Plus;
+    platforms = platforms.linux;
+  };
+}