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