2024-09-26 11:04:55 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
fetchurl,
|
|
|
|
autoreconfHook,
|
|
|
|
enableMail ? false,
|
|
|
|
gnused,
|
|
|
|
hostname,
|
|
|
|
mailutils,
|
|
|
|
systemdLibs,
|
|
|
|
IOKit,
|
|
|
|
ApplicationServices,
|
2021-08-12 14:41:47 +00:00
|
|
|
}:
|
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
|
|
|
};
|
2024-09-26 11:04:55 +00:00
|
|
|
scriptPath = lib.makeBinPath (
|
|
|
|
[
|
|
|
|
gnused
|
|
|
|
hostname
|
|
|
|
]
|
|
|
|
++ lib.optionals enableMail [ 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";
|
2023-10-09 19:29:22 +00:00
|
|
|
version = "7.4";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "mirror://sourceforge/smartmontools/${pname}-${version}.tar.gz";
|
2023-10-09 19:29:22 +00:00
|
|
|
hash = "sha256-6aYfZB/5bKlTGe37F5SM0pfQzTNCc2ssScmdRxb7mT0=";
|
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
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
configureFlags = [
|
|
|
|
"--with-scriptpath=${scriptPath}"
|
|
|
|
# does not work on NixOS
|
|
|
|
"--without-update-smart-drivedb"
|
|
|
|
];
|
2020-09-25 04:45:31 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
nativeBuildInputs = [ autoreconfHook ];
|
2024-09-26 11:04:55 +00:00
|
|
|
buildInputs =
|
|
|
|
lib.optionals stdenv.hostPlatform.isLinux [ systemdLibs ]
|
|
|
|
++ lib.optionals stdenv.hostPlatform.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
|
|
|
};
|
|
|
|
}
|