From cc7ce7611924425b4f269da7a9bc3ca7d3ac8514 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Sat, 5 Dec 2020 14:14:20 +0200 Subject: [PATCH] ocrfeeder: init at 0.8.3 --- .../graphics/ocrfeeder/default.nix | 73 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 2 files changed, 75 insertions(+) create mode 100644 pkgs/applications/graphics/ocrfeeder/default.nix diff --git a/pkgs/applications/graphics/ocrfeeder/default.nix b/pkgs/applications/graphics/ocrfeeder/default.nix new file mode 100644 index 00000000000..28fe58183fa --- /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; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 94e18adbc2a..65e38258df7 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -2460,6 +2460,8 @@ in ocrmypdf = callPackage ../tools/text/ocrmypdf { }; + ocrfeeder = callPackage ../applications/graphics/ocrfeeder { }; + onboard = callPackage ../applications/misc/onboard { }; oneshot = callPackage ../tools/networking/oneshot { };