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