1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pythonOlder,
6 installShellFiles,
7 setuptools,
8 setuptools-scm,
9 wheel,
10 docopt,
11 hidapi,
12 pyusb,
13 smbus-cffi,
14 i2c-tools,
15 pytestCheckHook,
16 colorlog,
17 crcmod,
18 pillow,
19 udevCheckHook,
20}:
21
22buildPythonPackage rec {
23 pname = "liquidctl";
24 version = "1.15.0";
25 format = "pyproject";
26
27 disabled = pythonOlder "3.8";
28
29 src = fetchFromGitHub {
30 owner = "liquidctl";
31 repo = "liquidctl";
32 tag = "v${version}";
33 hash = "sha256-ifYPUAF0lR9aCwiseNQZXbq+d+CXD/MwnZQhAM1TRLI=";
34 };
35
36 nativeBuildInputs = [
37 installShellFiles
38 setuptools
39 setuptools-scm
40 wheel
41 udevCheckHook
42 ];
43
44 propagatedBuildInputs = [
45 docopt
46 hidapi
47 pyusb
48 smbus-cffi
49 i2c-tools
50 colorlog
51 crcmod
52 pillow
53 ];
54
55 propagatedNativeBuildInputs = [ smbus-cffi ];
56
57 outputs = [
58 "out"
59 "man"
60 ];
61
62 postInstall = ''
63 installManPage liquidctl.8
64 installShellCompletion extra/completions/liquidctl.bash
65
66 mkdir -p $out/lib/udev/rules.d
67 cp extra/linux/71-liquidctl.rules $out/lib/udev/rules.d/.
68 '';
69
70 nativeCheckInputs = [ pytestCheckHook ];
71
72 postBuild = ''
73 # needed for pythonImportsCheck
74 export XDG_RUNTIME_DIR=$TMPDIR
75 '';
76
77 pythonImportsCheck = [ "liquidctl" ];
78
79 meta = with lib; {
80 description = "Cross-platform CLI and Python drivers for AIO liquid coolers and other devices";
81 homepage = "https://github.com/liquidctl/liquidctl";
82 changelog = "https://github.com/liquidctl/liquidctl/blob/${src.tag}/CHANGELOG.md";
83 license = licenses.gpl3Plus;
84 maintainers = with maintainers; [
85 arturcygan
86 evils
87 ];
88 mainProgram = "liquidctl";
89 };
90}