1{
2 lib,
3 stdenv,
4 aiohttp,
5 aiomqtt,
6 aioresponses,
7 async-timeout,
8 buildPythonPackage,
9 click,
10 construct,
11 dacite,
12 fetchFromGitHub,
13 freezegun,
14 paho-mqtt,
15 poetry-core,
16 pycryptodome,
17 pycryptodomex,
18 pyrate-limiter,
19 pytest-asyncio,
20 pytestCheckHook,
21 pythonOlder,
22 vacuum-map-parser-roborock,
23 pyshark,
24}:
25
26buildPythonPackage rec {
27 pname = "python-roborock";
28 version = "2.25.0";
29 pyproject = true;
30
31 disabled = pythonOlder "3.11";
32
33 src = fetchFromGitHub {
34 owner = "humbertogontijo";
35 repo = "python-roborock";
36 tag = "v${version}";
37 hash = "sha256-RsNWhcScp81plqXg9NmRFJhF+aLA0ld0A5H6mHo60uE=";
38 };
39
40 postPatch = ''
41 substituteInPlace pyproject.toml \
42 --replace-fail "poetry-core==1.8.0" "poetry-core"
43 '';
44
45 pythonRelaxDeps = [ "pycryptodome" ];
46
47 build-system = [ poetry-core ];
48
49 dependencies = [
50 aiohttp
51 aiomqtt
52 async-timeout
53 click
54 construct
55 dacite
56 paho-mqtt
57 pycryptodome
58 pyrate-limiter
59 vacuum-map-parser-roborock
60 pyshark
61 ]
62 ++ lib.optionals stdenv.hostPlatform.isDarwin [ pycryptodomex ];
63
64 nativeCheckInputs = [
65 aioresponses
66 freezegun
67 pytest-asyncio
68 pytestCheckHook
69 ];
70
71 pythonImportsCheck = [ "roborock" ];
72
73 meta = with lib; {
74 description = "Python library & console tool for controlling Roborock vacuum";
75 homepage = "https://github.com/humbertogontijo/python-roborock";
76 changelog = "https://github.com/humbertogontijo/python-roborock/blob/${src.tag}/CHANGELOG.md";
77 license = licenses.gpl3Only;
78 maintainers = with maintainers; [ fab ];
79 mainProgram = "roborock";
80 };
81}