From 39959e10a829ea87198dae12392066b92a5ea383 Mon Sep 17 00:00:00 2001 From: wxt <3264117476@qq.com> Date: Tue, 12 Nov 2024 21:11:28 +0800 Subject: [PATCH 1/2] ocrfeeder: nixfmt --- pkgs/by-name/oc/ocrfeeder/package.nix | 69 +++++++++++++++------------ 1 file changed, 38 insertions(+), 31 deletions(-) diff --git a/pkgs/by-name/oc/ocrfeeder/package.nix b/pkgs/by-name/oc/ocrfeeder/package.nix index 05d157c2d9b4..b2ad88f20e4c 100644 --- a/pkgs/by-name/oc/ocrfeeder/package.nix +++ b/pkgs/by-name/oc/ocrfeeder/package.nix @@ -1,18 +1,20 @@ -{ lib, stdenv -, fetchurl -, pkg-config -, wrapGAppsHook3 -, intltool -, itstool -, libxml2 -, gobject-introspection -, gtk3 -, goocanvas2 -, gtkspell3 -, isocodes -, python3 -, tesseract4 -, extraOcrEngines ? [] # other supported engines are: ocrad gocr cuneiform +{ + lib, + stdenv, + fetchurl, + pkg-config, + wrapGAppsHook3, + intltool, + itstool, + libxml2, + gobject-introspection, + gtk3, + goocanvas2, + gtkspell3, + isocodes, + python3, + tesseract4, + extraOcrEngines ? [ ], # other supported engines are: ocrad gocr cuneiform }: stdenv.mkDerivation (finalAttrs: { @@ -21,7 +23,7 @@ stdenv.mkDerivation (finalAttrs: { src = fetchurl { url = "mirror://gnome/sources/ocrfeeder/${lib.versions.majorMinor finalAttrs.version}/ocrfeeder-${finalAttrs.version}.tar.xz"; - sha256 = "sha256-sD0qWUndguJzTw0uy0FIqupFf4OX6dTFvcd+Mz+8Su0="; + hash = "sha256-sD0qWUndguJzTw0uy0FIqupFf4OX6dTFvcd+Mz+8Su0="; }; nativeBuildInputs = [ @@ -38,14 +40,16 @@ stdenv.mkDerivation (finalAttrs: { goocanvas2 gtkspell3 isocodes - (python3.withPackages(ps: with ps; [ - pyenchant - sane - pillow - reportlab - odfpy - pygobject3 - ])) + (python3.withPackages ( + ps: with ps; [ + pyenchant + sane + pillow + reportlab + odfpy + pygobject3 + ] + )) ]; patches = [ # Compiles, but doesn't launch without this, see: @@ -53,20 +57,23 @@ stdenv.mkDerivation (finalAttrs: { ./fix-launch.diff ]; - enginesPath = lib.makeBinPath ([ - tesseract4 - ] ++ extraOcrEngines); + enginesPath = lib.makeBinPath ( + [ + tesseract4 + ] + ++ extraOcrEngines + ); preFixup = '' gappsWrapperArgs+=(--prefix PATH : "${finalAttrs.enginesPath}") gappsWrapperArgs+=(--set ISO_CODES_DIR "${isocodes}/share/xml/iso-codes") ''; - meta = with lib; { + meta = { 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; + maintainers = with lib.maintainers; [ doronbehar ]; + license = lib.licenses.gpl3Plus; + platforms = lib.platforms.linux; }; }) From dcc7d30300f716e52f27cc1e21ed66ae419cba87 Mon Sep 17 00:00:00 2001 From: wxt <3264117476@qq.com> Date: Tue, 12 Nov 2024 21:38:24 +0800 Subject: [PATCH 2/2] ocrfeeder: fix build --- pkgs/by-name/oc/ocrfeeder/package.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkgs/by-name/oc/ocrfeeder/package.nix b/pkgs/by-name/oc/ocrfeeder/package.nix index b2ad88f20e4c..5dc36c45b4ca 100644 --- a/pkgs/by-name/oc/ocrfeeder/package.nix +++ b/pkgs/by-name/oc/ocrfeeder/package.nix @@ -35,6 +35,13 @@ stdenv.mkDerivation (finalAttrs: { gobject-introspection ]; + postPatch = '' + substituteInPlace configure \ + --replace-fail "import imp" "import importlib.util" \ + --replace-fail "imp.find_module" "importlib.util.find_spec" \ + --replace-fail "distutils" "setuptools._distutils" + ''; + buildInputs = [ gtk3 goocanvas2