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