blob: b8c594dde47014a0ae5c303679d2464be8e12abb (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
{
lib,
stdenv,
fetchurl,
autoreconfHook,
enableMail ? false,
gnused,
hostname,
mailutils,
systemdLibs,
IOKit,
ApplicationServices,
}:
let
dbrev = "5388";
drivedbBranch = "RELEASE_7_3_DRIVEDB";
driverdb = fetchurl {
url = "https://sourceforge.net/p/smartmontools/code/${dbrev}/tree/branches/${drivedbBranch}/smartmontools/drivedb.h?format=raw";
sha256 = "sha256-0dtLev4JjeHsS259+qOgg19rz4yjkeX4D3ooUgS4RTI=";
name = "smartmontools-drivedb.h";
};
scriptPath = lib.makeBinPath (
[
gnused
hostname
]
++ lib.optionals enableMail [ mailutils ]
);
in
stdenv.mkDerivation rec {
pname = "smartmontools";
version = "7.4";
src = fetchurl {
url = "mirror://sourceforge/smartmontools/${pname}-${version}.tar.gz";
hash = "sha256-6aYfZB/5bKlTGe37F5SM0pfQzTNCc2ssScmdRxb7mT0=";
};
patches = [
# fixes darwin build
./smartmontools.patch
];
postPatch = ''
cp -v ${driverdb} drivedb.h
'';
configureFlags = [
"--with-scriptpath=${scriptPath}"
# does not work on NixOS
"--without-update-smart-drivedb"
];
nativeBuildInputs = [ autoreconfHook ];
buildInputs =
lib.optionals stdenv.hostPlatform.isLinux [ systemdLibs ]
++ lib.optionals stdenv.hostPlatform.isDarwin [
IOKit
ApplicationServices
];
enableParallelBuilding = true;
meta = with lib; {
description = "Tools for monitoring the health of hard drives";
homepage = "https://www.smartmontools.org/";
license = licenses.gpl2Plus;
maintainers = with maintainers; [ Frostman ];
platforms = with platforms; linux ++ darwin;
mainProgram = "smartctl";
};
}
|