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