1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, pythonOlder
5, installShellFiles
6, docopt
7, hidapi
8, pyusb
9, smbus-cffi
10, i2c-tools
11, pytestCheckHook
12, colorlog
13}:
14
15buildPythonPackage rec {
16 pname = "liquidctl";
17 version = "1.7.2";
18 disabled = pythonOlder "3.6";
19
20 src = fetchFromGitHub {
21 owner = pname;
22 repo = pname;
23 rev = "v${version}";
24 sha256 = "sha256-fPSvxdr329SxAe4N7lTa7hddFp1WVUplkhYD1oDQXAI=";
25 };
26
27 nativeBuildInputs = [ installShellFiles ];
28
29 propagatedBuildInputs = [
30 docopt
31 hidapi
32 pyusb
33 smbus-cffi
34 i2c-tools
35 colorlog
36 ];
37
38 propagatedNativeBuildInputs = [
39 smbus-cffi
40 ];
41
42 outputs = [ "out" "man" ];
43
44 postInstall = ''
45 installManPage liquidctl.8
46 installShellCompletion extra/completions/liquidctl.bash
47
48 mkdir -p $out/lib/udev/rules.d
49 cp extra/linux/71-liquidctl.rules $out/lib/udev/rules.d/.
50 '';
51
52 checkInputs = [ pytestCheckHook ];
53
54 postBuild = ''
55 # needed for pythonImportsCheck
56 export XDG_RUNTIME_DIR=$TMPDIR
57 '';
58
59 pythonImportsCheck = [ "liquidctl" ];
60
61 meta = with lib; {
62 description = "Cross-platform CLI and Python drivers for AIO liquid coolers and other devices";
63 homepage = "https://github.com/liquidctl/liquidctl";
64 changelog = "https://github.com/liquidctl/liquidctl/blob/master/CHANGELOG.md";
65 license = licenses.gpl3Plus;
66 maintainers = with maintainers; [ arturcygan evils ];
67 };
68}