about summary refs log tree commit diff
path: root/nixpkgs/pkgs/os-specific/linux/powertop/default.nix
blob: b8a0487bc7e77b2caecc42d8629ebd9bc178c1ea (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
{ lib, stdenv, fetchFromGitHub, gettext, libnl, ncurses, pciutils
, pkg-config, zlib, autoreconfHook }:

stdenv.mkDerivation rec {
  pname = "powertop";
  version = "2.14";

  src = fetchFromGitHub {
    owner = "fenrus75";
    repo = pname;
    rev = "v${version}";
    sha256 = "1zkr2y5nb1nr22nq8a3zli87iyfasfq6489p7h1k428pv8k45w4f";
  };

  outputs = [ "out" "man" ];

  nativeBuildInputs = [ pkg-config autoreconfHook ];
  buildInputs = [ gettext libnl ncurses pciutils zlib ];

  NIX_LDFLAGS = [ "-lpthread" ];

  postPatch = ''
    substituteInPlace src/main.cpp --replace "/sbin/modprobe" "modprobe"
    substituteInPlace src/calibrate/calibrate.cpp --replace "/usr/bin/xset" "xset"
    substituteInPlace src/tuning/bluetooth.cpp --replace "/usr/bin/hcitool" "hcitool"
  '';

  meta = with lib; {
    description = "Analyze power consumption on Intel-based laptops";
    homepage = "https://01.org/powertop";
    license = licenses.gpl2Only;
    maintainers = with maintainers; [ fpletz ];
    platforms = platforms.linux;
  };
}