summary refs log tree commit diff
path: root/pkgs/os-specific/linux/freefall
diff options
context:
space:
mode:
authorTobias Geerinckx-Rice <tobias.geerinckx.rice@gmail.com>2015-01-20 10:23:57 +0100
committerTobias Geerinckx-Rice <tobias.geerinckx.rice@gmail.com>2015-01-28 15:59:20 +0100
commit94a600772edf2568985837953958a82ab3cc599a (patch)
tree17a868efbdbb89f57361f5ced763796cfb6af9cd /pkgs/os-specific/linux/freefall
parentb61d4ac6a5018f75d187761071be57fd4f6ae006 (diff)
downloadnixpkgs-94a600772edf2568985837953958a82ab3cc599a.tar
nixpkgs-94a600772edf2568985837953958a82ab3cc599a.tar.gz
nixpkgs-94a600772edf2568985837953958a82ab3cc599a.tar.bz2
nixpkgs-94a600772edf2568985837953958a82ab3cc599a.tar.lz
nixpkgs-94a600772edf2568985837953958a82ab3cc599a.tar.xz
nixpkgs-94a600772edf2568985837953958a82ab3cc599a.tar.zst
nixpkgs-94a600772edf2568985837953958a82ab3cc599a.zip
Add freefall: hard drive protection on HP/Dell laptops
Diffstat (limited to 'pkgs/os-specific/linux/freefall')
-rw-r--r--pkgs/os-specific/linux/freefall/default.nix42
1 files changed, 42 insertions, 0 deletions
diff --git a/pkgs/os-specific/linux/freefall/default.nix b/pkgs/os-specific/linux/freefall/default.nix
new file mode 100644
index 00000000000..9903cb5b963
--- /dev/null
+++ b/pkgs/os-specific/linux/freefall/default.nix
@@ -0,0 +1,42 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  version = "3.18.3";
+  name = "freefall-${version}";
+
+  src = fetchurl {
+    url = "mirror://kernel/linux/kernel/v3.x/linux-${version}.tar.xz";
+    sha256 = "0ma2x68975xsi9kb15p0615nx9sm5ppb309kfdz7fgx9pg84q0hf";
+  };
+
+  buildPhase = ''
+    cd Documentation/laptops
+
+    # Default time-out is a little low, probably because the AC/lid status
+    # functions were never implemented. Because no-one still uses HDDs, right?
+    substituteInPlace freefall.c --replace "alarm(2)" "alarm(5)"
+
+    cc -o freefall freefall.c
+  '';
+
+  installPhase = ''
+    mkdir -p $out/bin
+    install freefall $out/bin
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Free-fall protection for spinning HP/Dell laptop hard drives";
+    longDescription = ''
+      ATA/ATAPI-7 specifies the IDLE IMMEDIATE command with unload feature.
+      Issuing this command should cause the drive to switch to idle mode and
+      unload disk heads. This feature is being used in modern laptops in
+      conjunction with accelerometers and appropriate software to implement
+      a shock protection facility. The idea is to stop all I/O operations on
+      the internal hard drive and park its heads on the ramp when critical
+      situations are anticipated. This has no effect on SSD devices!
+    '';
+    license = with licenses; gpl2;
+    platforms = with platforms; linux;
+    maintainers = with maintainers; [ nckx ];
+  };
+}