1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 chardet,
6 humanfriendly,
7 pytestCheckHook,
8 pythonOlder,
9 setuptools-scm,
10 smartmontools,
11}:
12
13buildPythonPackage rec {
14 pname = "pysmart";
15 version = "1.4.1";
16 format = "pyproject";
17
18 disabled = pythonOlder "3.7";
19
20 src = fetchFromGitHub {
21 owner = "truenas";
22 repo = "py-SMART";
23 tag = "v${version}";
24 hash = "sha256-eVrJ83MTIlu7sDrOoaXwiWqxYmDJFU8tf+pb3ui9N5w=";
25 };
26
27 postPatch = ''
28 substituteInPlace pySMART/utils.py \
29 --replace "which('smartctl')" '"${smartmontools}/bin/smartctl"'
30 '';
31
32 propagatedBuildInputs = [
33 chardet
34 humanfriendly
35 ];
36
37 nativeBuildInputs = [ setuptools-scm ];
38
39 nativeCheckInputs = [ pytestCheckHook ];
40
41 pythonImportsCheck = [ "pySMART" ];
42
43 meta = with lib; {
44 description = "Wrapper for smartctl (smartmontools)";
45 homepage = "https://github.com/truenas/py-SMART";
46 changelog = "https://github.com/truenas/py-SMART/blob/${src.tag}/CHANGELOG.md";
47 license = licenses.lgpl21Only;
48 maintainers = with maintainers; [ nyanloutre ];
49 };
50}