1{
2 lib,
3 bitvector-for-humans,
4 buildPythonPackage,
5 busylight-core,
6 fastapi,
7 fetchFromGitHub,
8 hatchling,
9 hidapi,
10 httpx,
11 loguru,
12 pyserial,
13 pytest-mock,
14 pytestCheckHook,
15 typer,
16 udevCheckHook,
17 uvicorn,
18 webcolors,
19}:
20
21buildPythonPackage rec {
22 pname = "busylight-for-humans";
23 version = "0.45.2";
24 pyproject = true;
25
26 src = fetchFromGitHub {
27 owner = "JnyJny";
28 repo = "busylight";
29 tag = "v${version}";
30 hash = "sha256-G+l+jkHZzz3tX1CcC7Cq1iCFZPbeQ6CI4xCMkTWA5EE=";
31 };
32
33 build-system = [ hatchling ];
34
35 dependencies = [
36 bitvector-for-humans
37 busylight-core
38 hidapi
39 loguru
40 pyserial
41 typer
42 webcolors
43 ];
44
45 optional-dependencies = {
46 webapi = [
47 fastapi
48 uvicorn
49 ];
50 };
51
52 nativeCheckInputs = [
53 httpx
54 pytestCheckHook
55 pytest-mock
56 udevCheckHook
57 ]
58 ++ lib.flatten (builtins.attrValues optional-dependencies);
59
60 disabledTestPaths = [ "tests/test_pydantic_models.py" ];
61
62 pythonImportsCheck = [ "busylight" ];
63
64 postInstall = ''
65 mkdir -p $out/lib/udev/rules.d
66 $out/bin/busylight udev-rules -o $out/lib/udev/rules.d/99-busylight.rules
67 '';
68
69 meta = with lib; {
70 description = "Control USB connected presence lights from multiple vendors via the command-line or web API";
71 homepage = "https://github.com/JnyJny/busylight";
72 changelog = "https://github.com/JnyJny/busylight/releases/tag/${src.tag}";
73 license = licenses.asl20;
74 teams = [ teams.helsinki-systems ];
75 mainProgram = "busylight";
76 };
77}