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