1{ lib
2, async-timeout
3, bluez
4, buildPythonPackage
5, dbus-fast
6, fetchFromGitHub
7, poetry-core
8, pytest-asyncio
9, pytestCheckHook
10, pythonOlder
11, typing-extensions
12}:
13
14buildPythonPackage rec {
15 pname = "bleak";
16 version = "0.19.4";
17 format = "pyproject";
18
19 disabled = pythonOlder "3.8";
20
21 src = fetchFromGitHub {
22 owner = "hbldh";
23 repo = pname;
24 rev = "refs/tags/v${version}";
25 hash = "sha256-Sdgsf1gFA0UcyFuaScwqmvHV2E6Crb6vSQgUbBox5hw=";
26 };
27
28 nativeBuildInputs = [
29 poetry-core
30 ];
31
32 propagatedBuildInputs = [
33 async-timeout
34 dbus-fast
35 typing-extensions
36 ];
37
38 checkInputs = [
39 pytest-asyncio
40 pytestCheckHook
41 ];
42
43 postPatch = ''
44 # bleak checks BlueZ's version with a call to `bluetoothctl --version`
45 substituteInPlace bleak/backends/bluezdbus/__init__.py \
46 --replace \"bluetoothctl\" \"${bluez}/bin/bluetoothctl\"
47 '';
48
49 pythonImportsCheck = [
50 "bleak"
51 ];
52
53 meta = with lib; {
54 description = "Bluetooth Low Energy platform agnostic client";
55 homepage = "https://github.com/hbldh/bleak";
56 license = licenses.mit;
57 platforms = platforms.linux;
58 maintainers = with maintainers; [ oxzi ];
59 };
60}