summary refs log tree commit diff
path: root/pkgs/os-specific/linux/phc-intel/default.nix
diff options
context:
space:
mode:
authorTobias Geerinckx-Rice <tobias.geerinckx.rice@gmail.com>2015-05-09 00:11:20 +0200
committerTobias Geerinckx-Rice <tobias.geerinckx.rice@gmail.com>2015-05-09 01:25:58 +0200
commit1f6c2a97efe8dd2fac692c287f6ae31d4c74519c (patch)
tree6a74f24e00b5ef26712dfb65f9c895c528c0fd39 /pkgs/os-specific/linux/phc-intel/default.nix
parentdaa5938c6a2792993fc49c52bf510809ce13b843 (diff)
downloadnixpkgs-1f6c2a97efe8dd2fac692c287f6ae31d4c74519c.tar
nixpkgs-1f6c2a97efe8dd2fac692c287f6ae31d4c74519c.tar.gz
nixpkgs-1f6c2a97efe8dd2fac692c287f6ae31d4c74519c.tar.bz2
nixpkgs-1f6c2a97efe8dd2fac692c287f6ae31d4c74519c.tar.lz
nixpkgs-1f6c2a97efe8dd2fac692c287f6ae31d4c74519c.tar.xz
nixpkgs-1f6c2a97efe8dd2fac692c287f6ae31d4c74519c.tar.zst
nixpkgs-1f6c2a97efe8dd2fac692c287f6ae31d4c74519c.zip
Add phc-intel: undervolt Intel CPUs under Linux
Diffstat (limited to 'pkgs/os-specific/linux/phc-intel/default.nix')
-rw-r--r--pkgs/os-specific/linux/phc-intel/default.nix47
1 files changed, 47 insertions, 0 deletions
diff --git a/pkgs/os-specific/linux/phc-intel/default.nix b/pkgs/os-specific/linux/phc-intel/default.nix
new file mode 100644
index 00000000000..1b4ee3218eb
--- /dev/null
+++ b/pkgs/os-specific/linux/phc-intel/default.nix
@@ -0,0 +1,47 @@
+{ stdenv, fetchurl, kernel, which }:
+
+assert stdenv.isLinux;
+# don't bother with older versions, though some would probably work:
+assert stdenv.lib.versionAtLeast kernel.version "4.0";
+
+let version = "0.4.0-rev17"; in
+stdenv.mkDerivation rec {
+  name = "linux-phc-intel-${version}-${kernel.version}";
+
+  src = fetchurl {
+    sha256 = "1fdfpghnsa5s98lisd2sn0vplrq0n54l0pkyyzkyb77z4fa6bs4p";
+    url = "http://www.linux-phc.org/forum/download/file.php?id=166";
+    name = "phc-intel-pack-rev17.tar.bz2";
+  };
+
+  meta = with stdenv.lib; {
+    inherit version;
+    description = "Undervolting kernel driver for Intel processors";
+    longDescription = ''
+      PHC is a Linux kernel patch to undervolt processors. This can divide the
+      power consumption of the CPU by two or more, increasing battery life
+      while noticably reducing fan noise. This driver works only on supported
+      Intel architectures.
+    '';
+    homepage = http://www.linux-phc.org/;
+    downloadPage = "http://www.linux-phc.org/forum/viewtopic.php?f=7&t=267";
+    license = with licenses; gpl2;
+    platforms = with platforms; linux;
+    maintainers = with maintainers; [ nckx ];
+  };
+
+  buildInputs = [ which ];
+
+  makeFlags = "KERNELSRC=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build DESTDIR=$(out)";
+
+  configurePhase = ''
+    echo make $makeFlags brave
+  '';
+
+  enableParallelBuilding = false;
+
+  installPhase = ''
+    install -m 755   -d $out/lib/modules/${kernel.version}/extra/
+    install -m 644 *.ko $out/lib/modules/${kernel.version}/extra/
+  '';
+}