From 7803a696cd03486a3462f83120bf5088e9af6fd5 Mon Sep 17 00:00:00 2001
From: Peter Simons <simons@cryp.to>
Date: Thu, 23 Feb 2017 00:17:51 +0100
Subject: [PATCH] smartmontools: update drivedb.h to latest SVN version 4391

---
 pkgs/tools/system/smartmontools/default.nix | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/pkgs/tools/system/smartmontools/default.nix b/pkgs/tools/system/smartmontools/default.nix
index 1a9e2d3b5b9b..c3f05edd9adb 100644
--- a/pkgs/tools/system/smartmontools/default.nix
+++ b/pkgs/tools/system/smartmontools/default.nix
@@ -1,8 +1,20 @@
-{ stdenv, fetchurl,
-IOKit ? null , ApplicationServices ? null }:
+{ stdenv, fetchurl, IOKit ? null , ApplicationServices ? null }:
+
+let
+
+  version = "6.5";
+
+  dbrev = "4391";
+  drivedbBranch = "RELEASE_${builtins.replaceStrings ["."] ["_"] version}_DRIVEDB";
+  driverdb = fetchurl {
+    url = "http://sourceforge.net/p/smartmontools/code/${dbrev}/tree/branches/${drivedbBranch}/smartmontools/drivedb.h?format=raw";
+    sha256 = "1da99m81wr0rjdhcz2xx0sbbrqxkxffja2kllg4srmhih7fps5p1";
+    name = "smartmontools-drivedb.h";
+  };
+
+in
 
 stdenv.mkDerivation rec {
-  version = "6.5";
   name = "smartmontools-${version}";
 
   src = fetchurl {
@@ -13,6 +25,7 @@ stdenv.mkDerivation rec {
   buildInputs = [] ++ stdenv.lib.optionals stdenv.isDarwin [IOKit ApplicationServices];
 
   patches = [ ./smartmontools.patch ];
+  postPatch = "cp -v ${driverdb} drivedb.h";
 
   meta = with stdenv.lib; {
     description = "Tools for monitoring the health of hard drives";