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