gnome-frog: init at 1.1.3

+124
+89
pkgs/applications/misc/gnome-frog/default.nix
··· 1 + { stdenv 2 + , lib 3 + , fetchFromGitHub 4 + , python3Packages 5 + , wrapGAppsHook4 6 + , gtk4 7 + , meson 8 + , ninja 9 + , pkg-config 10 + , appstream-glib 11 + , desktop-file-utils 12 + , glib 13 + , gobject-introspection 14 + , libnotify 15 + , libadwaita 16 + , libportal 17 + , gettext 18 + , librsvg 19 + , tesseract5 20 + , zbar 21 + }: 22 + 23 + python3Packages.buildPythonApplication rec { 24 + pname = "gnome-frog"; 25 + version = "1.1.3"; 26 + 27 + src = fetchFromGitHub { 28 + owner = "TenderOwl"; 29 + repo = "Frog"; 30 + rev = version; 31 + sha256 = "sha256-yOjfiGJUU25zb/4WprPU59yDAMpttS3jREp1kB5mXUE="; 32 + }; 33 + 34 + format = "other"; 35 + 36 + patches = [ ./update-compatible-with-non-flatpak-env.patch ]; 37 + postPatch = '' 38 + chmod +x ./build-aux/meson/postinstall.py 39 + patchShebangs ./build-aux/meson/postinstall.py 40 + substituteInPlace ./build-aux/meson/postinstall.py \ 41 + --replace "gtk-update-icon-cache" "gtk4-update-icon-cache" 42 + substituteInPlace ./frog/language_manager.py --subst-var out 43 + ''; 44 + 45 + nativeBuildInputs = [ 46 + appstream-glib 47 + desktop-file-utils 48 + gettext 49 + meson 50 + ninja 51 + pkg-config 52 + glib 53 + wrapGAppsHook4 54 + ]; 55 + 56 + buildInputs = [ 57 + librsvg 58 + gobject-introspection 59 + libnotify 60 + libadwaita 61 + libportal 62 + zbar 63 + tesseract5 64 + ]; 65 + 66 + propagatedBuildInputs = with python3Packages; [ 67 + pygobject3 68 + pillow 69 + pytesseract 70 + pyzbar 71 + ]; 72 + 73 + # This is to prevent double-wrapping the package. We'll let 74 + # Python do it by adding certain arguments inside of the 75 + # wrapper instead. 76 + dontWrapGApps = true; 77 + preFixup = '' 78 + makeWrapperArgs+=("''${gappsWrapperArgs[@]}") 79 + ''; 80 + 81 + meta = with lib; { 82 + homepage = "https://getfrog.app/"; 83 + description = 84 + "Intuitive text extraction tool (OCR) for GNOME desktop"; 85 + license = licenses.mit; 86 + maintainers = with maintainers; [ foo-dogsquared ]; 87 + platforms = platforms.linux; 88 + }; 89 + }
+33
pkgs/applications/misc/gnome-frog/update-compatible-with-non-flatpak-env.patch
··· 1 + diff --git a/frog/config.py b/frog/config.py 2 + index 9837755..b73e4e3 100644 3 + --- a/frog/config.py 4 + +++ b/frog/config.py 5 + @@ -30,10 +30,14 @@ import os 6 + APP_ID = "com.github.tenderowl.frog" 7 + RESOURCE_PREFIX = "/com/github/tenderowl/frog" 8 + 9 + +# This is based from the XDG Base Directory specification. 10 + +if not os.getenv('XDG_DATA_HOME'): 11 + + os.environ['XDG_DATA_HOME'] = os.path.expanduser("~/.local/share") 12 + + 13 + if not os.path.exists(os.path.join(os.environ['XDG_DATA_HOME'], 'tessdata')): 14 + os.mkdir(os.path.join(os.environ['XDG_DATA_HOME'], 'tessdata')) 15 + 16 + tessdata_url = "https://github.com/tesseract-ocr/tessdata/raw/main/" 17 + tessdata_best_url = "https://github.com/tesseract-ocr/tessdata_best/raw/main/" 18 + tessdata_dir = os.path.join(os.environ['XDG_DATA_HOME'], 'tessdata') 19 + -tessdata_config = f'--tessdata-dir {tessdata_dir} –psm 6' 20 + +tessdata_config = f'–-psm 6 --tessdata-dir {tessdata_dir}' 21 + diff --git a/frog/language_manager.py b/frog/language_manager.py 22 + index 5752be6..4f6a908 100644 23 + --- a/frog/language_manager.py 24 + +++ b/frog/language_manager.py 25 + @@ -156,7 +156,7 @@ class LanguageManager(GObject.GObject): 26 + os.mkdir(tessdata_dir) 27 + 28 + dest_path = os.path.join(tessdata_dir, 'eng.traineddata') 29 + - source_path = pathlib.Path('/app/share/appdata/eng.traineddata') 30 + + source_path = pathlib.Path('@out@/share/appdata/eng.traineddata') 31 + if os.path.exists(dest_path): 32 + return 33 +
+2
pkgs/top-level/all-packages.nix
··· 6694 6694 6695 6695 gnome-feeds = callPackage ../applications/networking/feedreaders/gnome-feeds {}; 6696 6696 6697 + gnome-frog = callPackage ../applications/misc/gnome-frog { }; 6698 + 6697 6699 gnome-keysign = callPackage ../tools/security/gnome-keysign { }; 6698 6700 6699 6701 gnome-secrets = callPackage ../applications/misc/gnome-secrets { };