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