From 834e7e8b73b8e681e8c40d522fb81a9d25234c57 Mon Sep 17 00:00:00 2001 From: "P. R. d. O" Date: Mon, 7 Mar 2022 11:49:21 -0600 Subject: [PATCH] cobang: init at 0.9.6 --- .../0001-Poetry-core-and-pillow-9.patch | 31 ++++++ pkgs/applications/misc/cobang/default.nix | 102 ++++++++++++++++++ pkgs/top-level/all-packages.nix | 4 + 3 files changed, 137 insertions(+) create mode 100644 pkgs/applications/misc/cobang/0001-Poetry-core-and-pillow-9.patch create mode 100644 pkgs/applications/misc/cobang/default.nix diff --git a/pkgs/applications/misc/cobang/0001-Poetry-core-and-pillow-9.patch b/pkgs/applications/misc/cobang/0001-Poetry-core-and-pillow-9.patch new file mode 100644 index 00000000000..d3c32cf9640 --- /dev/null +++ b/pkgs/applications/misc/cobang/0001-Poetry-core-and-pillow-9.patch @@ -0,0 +1,31 @@ +From 324a267b0e5505c9124874581bc48fb174fb2542 Mon Sep 17 00:00:00 2001 +From: "P. R. d. O" +Date: Fri, 4 Mar 2022 07:03:17 -0600 +Subject: [PATCH] Pillow update + +--- + pyproject.toml | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/pyproject.toml b/pyproject.toml +index 5dc25e0..b3ba397 100644 +--- a/pyproject.toml ++++ b/pyproject.toml +@@ -11,7 +11,7 @@ readme = "README.rst" + [tool.poetry.dependencies] + python = "^3.7" + logbook = "^1.5.3" +-Pillow = "^8.2.0" ++Pillow = "^9.0.0" + requests = "^2.24.0" + kiss-headers = "^2.2.3" + single-version = "^1.5.1" +@@ -33,4 +33,4 @@ skip-string-normalization = true + + [build-system] + requires = ["poetry>=0.12"] +-build-backend = "poetry.masonry.api" ++build-backend = "poetry.core.masonry.api" +-- +2.35.1 + diff --git a/pkgs/applications/misc/cobang/default.nix b/pkgs/applications/misc/cobang/default.nix new file mode 100644 index 00000000000..1401a7a8df2 --- /dev/null +++ b/pkgs/applications/misc/cobang/default.nix @@ -0,0 +1,102 @@ +{ lib +, buildPythonApplication +, fetchFromGitHub +, wrapGAppsHook +, atk +, gdk-pixbuf +, gobject-introspection +, gtk3 +, gst-plugins-good +, libhandy +, librsvg +, networkmanager +, pango +, gst-python +, kiss-headers +, Logbook +, pillow +, poetry-core +, pygobject3 +, python +, python-zbar +, requests +, single-version +, pytestCheckHook }: + +buildPythonApplication rec { + pname = "cobang"; + version = "0.9.6"; + format = "pyproject"; + + src = fetchFromGitHub { + owner = "hongquan"; + repo = "CoBang"; + rev = "v${version}"; + sha256 = "sha256-YcXQ2wAgFSsJEqcaDQotpX1put4pQaF511kwq/c2yHw="; + }; + + patches = [ + ./0001-Poetry-core-and-pillow-9.patch + ]; + + nativeBuildInputs = [ + gobject-introspection + wrapGAppsHook + ]; + + propagatedBuildInputs = [ + gst-python + kiss-headers + Logbook + pillow + poetry-core + pygobject3 + python-zbar + requests + single-version + ]; + + buildInputs = [ + atk + gdk-pixbuf + # Needed to detect namespaces + gobject-introspection + gst-plugins-good + libhandy + networkmanager + pango + ]; + + checkInputs = [ + pytestCheckHook + ]; + + # Wrapping this manually for SVG recognition + dontWrapGApps = true; + + postInstall = '' + # Needed by the application + cp -R data $out/${python.sitePackages}/ + + # Icons and applications + install -Dm 644 $out/${python.sitePackages}/data/vn.hoabinh.quan.CoBang.svg -t $out/share/pixmaps/ + install -Dm 644 $out/${python.sitePackages}/data/vn.hoabinh.quan.CoBang.desktop -t $out/share/applications/ + substituteInPlace $out/share/applications/vn.hoabinh.quan.CoBang.desktop \ + --replace "Exec=" "Exec=$out/bin/" + ''; + + preFixup = '' + wrapProgram $out/bin/cobang \ + ''${gappsWrapperArgs[@]} \ + --prefix XDG_DATA_DIRS : "${gtk3}/share/gsettings-schemas/${gtk3.name}/" \ + --set GDK_PIXBUF_MODULE_FILE "${librsvg.out}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache" + ''; + + meta = with lib; { + description = "A QR code scanner desktop app for Linux"; + homepage = "https://github.com/hongquan/CoBang"; + license = licenses.gpl3Only; + maintainers = with maintainers; [ wolfangaukang ]; + platforms = [ "x86_64-linux" ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 24785322b0d..f48203741d5 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -4484,6 +4484,10 @@ with pkgs; inherit (darwin.apple_sdk.frameworks) CoreServices; }; + cobang = python3Packages.callPackage ../applications/misc/cobang { + gst-plugins-good = gst_all_1.gst-plugins-good.override { gtkSupport = true; }; + }; + cocoapods = callPackage ../development/mobile/cocoapods { }; cocoapods-beta = lowPrio (callPackage ../development/mobile/cocoapods { beta = true; });