@@ -0,0 +1,102 @@
1+{ lib
2+, buildPythonApplication
3+, fetchFromGitHub
4+, wrapGAppsHook
5+, atk
6+, gdk-pixbuf
7+, gobject-introspection
8+, gtk3
9+, gst-plugins-good
10+, libhandy
11+, librsvg
12+, networkmanager
13+, pango
14+, gst-python
15+, kiss-headers
16+, Logbook
17+, pillow
18+, poetry-core
19+, pygobject3
20+, python
21+, python-zbar
22+, requests
23+, single-version
24+, pytestCheckHook }:
25+
26+buildPythonApplication rec {
27+ pname = "cobang";
28+ version = "0.9.6";
29+ format = "pyproject";
30+
31+ src = fetchFromGitHub {
32+ owner = "hongquan";
33+ repo = "CoBang";
34+ rev = "v${version}";
35+ sha256 = "sha256-YcXQ2wAgFSsJEqcaDQotpX1put4pQaF511kwq/c2yHw=";
36+ };
37+
38+ patches = [
39+ ./0001-Poetry-core-and-pillow-9.patch
40+ ];
41+
42+ nativeBuildInputs = [
43+ gobject-introspection
44+ wrapGAppsHook
45+ ];
46+
47+ propagatedBuildInputs = [
48+ gst-python
49+ kiss-headers
50+ Logbook
51+ pillow
52+ poetry-core
53+ pygobject3
54+ python-zbar
55+ requests
56+ single-version
57+ ];
58+
59+ buildInputs = [
60+ atk
61+ gdk-pixbuf
62+ # Needed to detect namespaces
63+ gobject-introspection
64+ gst-plugins-good
65+ libhandy
66+ networkmanager
67+ pango
68+ ];
69+
70+ checkInputs = [
71+ pytestCheckHook
72+ ];
73+
74+ # Wrapping this manually for SVG recognition
75+ dontWrapGApps = true;
76+
77+ postInstall = ''
78+ # Needed by the application
79+ cp -R data $out/${python.sitePackages}/
80+
81+ # Icons and applications
82+ install -Dm 644 $out/${python.sitePackages}/data/vn.hoabinh.quan.CoBang.svg -t $out/share/pixmaps/
83+ install -Dm 644 $out/${python.sitePackages}/data/vn.hoabinh.quan.CoBang.desktop -t $out/share/applications/
84+ substituteInPlace $out/share/applications/vn.hoabinh.quan.CoBang.desktop \
85+ --replace "Exec=" "Exec=$out/bin/"
86+ '';
87+
88+ preFixup = ''
89+ wrapProgram $out/bin/cobang \
90+ ''${gappsWrapperArgs[@]} \
91+ --prefix XDG_DATA_DIRS : "${gtk3}/share/gsettings-schemas/${gtk3.name}/" \
92+ --set GDK_PIXBUF_MODULE_FILE "${librsvg.out}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache"
93+ '';
94+
95+ meta = with lib; {
96+ description = "A QR code scanner desktop app for Linux";
97+ homepage = "https://github.com/hongquan/CoBang";
98+ license = licenses.gpl3Only;
99+ maintainers = with maintainers; [ wolfangaukang ];
100+ platforms = [ "x86_64-linux" ];
101+ };
102+}