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