1{ lib
2, bleak
3, bleak-retry-connector
4, bluetooth-data-tools
5, bluetooth-sensor-state-data
6, buildPythonPackage
7, cryptography
8, fetchFromGitHub
9, home-assistant-bluetooth
10, poetry-core
11, pycryptodomex
12, pytestCheckHook
13, pythonOlder
14, sensor-state-data
15}:
16
17buildPythonPackage rec {
18 pname = "xiaomi-ble";
19 version = "0.21.1";
20 format = "pyproject";
21
22 disabled = pythonOlder "3.9";
23
24 src = fetchFromGitHub {
25 owner = "Bluetooth-Devices";
26 repo = pname;
27 rev = "refs/tags/v${version}";
28 hash = "sha256-5AzqsCWDgGhJ1EgJrbA8QHjP/Y14cIdSA0GKwZMrxX0=";
29 };
30
31 postPatch = ''
32 substituteInPlace pyproject.toml \
33 --replace " --cov=xiaomi_ble --cov-report=term-missing:skip-covered" "" \
34 --replace 'pycryptodomex = ">=3.18.0"' 'pycryptodomex = ">=3.17.0"'
35 '';
36
37 nativeBuildInputs = [
38 poetry-core
39 ];
40
41 propagatedBuildInputs = [
42 bleak
43 bleak-retry-connector
44 bluetooth-data-tools
45 bluetooth-sensor-state-data
46 cryptography
47 home-assistant-bluetooth
48 pycryptodomex
49 sensor-state-data
50 ];
51
52 nativeCheckInputs = [
53 pytestCheckHook
54 ];
55
56 pythonImportsCheck = [
57 "xiaomi_ble"
58 ];
59
60 meta = with lib; {
61 description = "Library for Xiaomi BLE devices";
62 homepage = "https://github.com/Bluetooth-Devices/xiaomi-ble";
63 changelog = "https://github.com/Bluetooth-Devices/xiaomi-ble/releases/tag/v${version}";
64 license = with licenses; [ mit ];
65 maintainers = with maintainers; [ fab ];
66 };
67}