1{ stdenv, kernel }:
2
3stdenv.mkDerivation rec {
4 inherit (kernel) version src;
5
6 name = "freefall-${version}";
7
8 postPatch = ''
9 cd tools/laptop/freefall
10
11 # Default time-out is a little low, probably because the AC/lid status
12 # functions were never implemented. Because no-one still uses HDDs, right?
13 substituteInPlace freefall.c --replace "alarm(2)" "alarm(5)"
14 '';
15
16 makeFlags = [ "PREFIX=$(out)" ];
17
18 meta = with stdenv.lib; {
19 inherit (kernel.meta) homepage license;
20
21 description = "Free-fall protection for spinning HP/Dell laptop hard drives";
22 longDescription = ''
23 Provides a shock protection facility in modern laptops with spinning hard
24 drives, by stopping all input/output operations on the internal hard drive
25 and parking its heads on the ramp when critical situations are anticipated.
26 Requires support for the ATA/ATAPI-7 IDLE IMMEDIATE command with unload
27 feature, which should cause the drive to switch to idle mode and unload the
28 disk heads, and an accelerometer device. It has no effect on SSD devices!
29 '';
30
31 platforms = platforms.linux;
32 };
33}