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