about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/bleak/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/python-modules/bleak/default.nix')
-rw-r--r--nixpkgs/pkgs/development/python-modules/bleak/default.nix49
1 files changed, 49 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/python-modules/bleak/default.nix b/nixpkgs/pkgs/development/python-modules/bleak/default.nix
new file mode 100644
index 000000000000..bd66c47c6cc1
--- /dev/null
+++ b/nixpkgs/pkgs/development/python-modules/bleak/default.nix
@@ -0,0 +1,49 @@
+{ lib
+, bluez
+, buildPythonPackage
+, dbus-next
+, fetchPypi
+, pytestCheckHook
+, pythonOlder
+, typing-extensions
+}:
+
+buildPythonPackage rec {
+  pname = "bleak";
+  version = "0.15.1";
+  format = "setuptools";
+
+  disabled = pythonOlder "3.7";
+
+  src = fetchPypi {
+    inherit pname version;
+    hash = "sha256-2MjYjeDyKhW9E1ugVsTlsvufFRGSg97yGx7X1DwA1ZA=";
+  };
+
+  propagatedBuildInputs = [
+    dbus-next
+    typing-extensions
+  ];
+
+  checkInputs = [
+    pytestCheckHook
+  ];
+
+  postPatch = ''
+    # bleak checks BlueZ's version with a call to `bluetoothctl --version`
+    substituteInPlace bleak/backends/bluezdbus/__init__.py \
+      --replace \"bluetoothctl\" \"${bluez}/bin/bluetoothctl\"
+  '';
+
+  pythonImportsCheck = [
+    "bleak"
+  ];
+
+  meta = with lib; {
+    description = "Bluetooth Low Energy platform agnostic client";
+    homepage = "https://github.com/hbldh/bleak";
+    license = licenses.mit;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ oxzi ];
+  };
+}