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