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