2021-08-12 14:41:47 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchurl
|
|
|
|
, autoreconfHook
|
|
|
|
, enableMail ? false
|
2022-08-21 13:32:41 +00:00
|
|
|
, gnused
|
2021-08-12 14:41:47 +00:00
|
|
|
, mailutils
|
|
|
|
, inetutils
|
|
|
|
, IOKit
|
|
|
|
, ApplicationServices
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
let
|
2022-06-26 10:26:21 +00:00
|
|
|
dbrev = "5388";
|
|
|
|
drivedbBranch = "RELEASE_7_3_DRIVEDB";
|
2020-04-24 23:36:52 +00:00
|
|
|
driverdb = fetchurl {
|
2021-08-12 14:41:47 +00:00
|
|
|
url = "https://sourceforge.net/p/smartmontools/code/${dbrev}/tree/branches/${drivedbBranch}/smartmontools/drivedb.h?format=raw";
|
2022-06-26 10:26:21 +00:00
|
|
|
sha256 = "sha256-0dtLev4JjeHsS259+qOgg19rz4yjkeX4D3ooUgS4RTI=";
|
2021-08-12 14:41:47 +00:00
|
|
|
name = "smartmontools-drivedb.h";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2022-09-09 14:08:57 +00:00
|
|
|
scriptPath = lib.makeBinPath ([ gnused ] ++ lib.optionals enableMail [ inetutils mailutils ]);
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-08-12 14:41:47 +00:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "smartmontools";
|
2022-06-26 10:26:21 +00:00
|
|
|
version = "7.3";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "mirror://sourceforge/smartmontools/${pname}-${version}.tar.gz";
|
2022-06-26 10:26:21 +00:00
|
|
|
sha256 = "sha256-pUT4gI0MWM+w50JMoYQcuFipdJIrA11QXU5MJIvjois=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-08-10 14:31:46 +00:00
|
|
|
patches = [
|
|
|
|
# fixes darwin build
|
|
|
|
./smartmontools.patch
|
|
|
|
];
|
2021-08-12 14:41:47 +00:00
|
|
|
postPatch = ''
|
|
|
|
cp -v ${driverdb} drivedb.h
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-09-09 14:08:57 +00:00
|
|
|
configureFlags = [ "--with-scriptpath=${scriptPath}" ];
|
2020-09-25 04:45:31 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
nativeBuildInputs = [ autoreconfHook ];
|
2021-08-10 14:31:46 +00:00
|
|
|
buildInputs = lib.optionals stdenv.isDarwin [ IOKit ApplicationServices ];
|
2020-04-24 23:36:52 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Tools for monitoring the health of hard drives";
|
2021-08-12 14:41:47 +00:00
|
|
|
homepage = "https://www.smartmontools.org/";
|
|
|
|
license = licenses.gpl2Plus;
|
2021-10-17 02:12:59 +00:00
|
|
|
maintainers = with maintainers; [ Frostman ];
|
2021-08-12 14:41:47 +00:00
|
|
|
platforms = with platforms; linux ++ darwin;
|
2021-07-18 21:22:44 +00:00
|
|
|
mainProgram = "smartctl";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|