1{
2 lib,
3 stdenv,
4 fetchurl,
5 kernel,
6 which,
7}:
8
9# Don't bother with older versions, though some might even work:
10assert lib.versionAtLeast kernel.version "4.10";
11
12let
13 release = "0.4.0";
14 revbump = "rev25"; # don't forget to change forum download id...
15in
16stdenv.mkDerivation rec {
17 name = "linux-phc-intel-${version}-${kernel.version}";
18 version = "${release}-${revbump}";
19
20 src = fetchurl {
21 sha256 = "1w91hpphd8i0br7g5qra26jdydqar45zqwq6jq8yyz6l0vb10zlz";
22 url = "http://www.linux-phc.org/forum/download/file.php?id=194";
23 name = "phc-intel-pack-${revbump}.tar.bz2";
24 };
25
26 nativeBuildInputs = [ which ] ++ kernel.moduleBuildDependencies;
27
28 hardeningDisable = [ "pic" ];
29
30 makeFlags = with kernel; [
31 "DESTDIR=$(out)"
32 "KERNELSRC=${dev}/lib/modules/${modDirVersion}/build"
33 ];
34
35 configurePhase = ''
36 make $makeFlags brave
37 '';
38
39 enableParallelBuilding = false;
40
41 installPhase = ''
42 install -m 755 -d $out/lib/modules/${kernel.modDirVersion}/extra/
43 install -m 644 *.ko $out/lib/modules/${kernel.modDirVersion}/extra/
44 '';
45
46 meta = with lib; {
47 description = "Undervolting kernel driver for Intel processors";
48 longDescription = ''
49 PHC is a Linux kernel patch to undervolt processors. This can divide the
50 power consumption of the CPU by two or more, increasing battery life
51 while noticably reducing fan noise. This driver works only on supported
52 Intel architectures.
53 '';
54 homepage = "https://github.com/danielw86dev/phc-intel-dkms";
55 license = licenses.gpl2Plus;
56 platforms = [
57 "x86_64-linux"
58 "i686-linux"
59 ];
60 broken = lib.versionAtLeast kernel.version "4.18";
61 };
62}