2021-12-06 16:07:01 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, fetchpatch, gettext, libnl, ncurses, pciutils
|
2021-08-05 21:33:18 +00:00
|
|
|
, pkg-config, zlib, autoreconfHook }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "powertop";
|
2021-08-05 21:33:18 +00:00
|
|
|
version = "2.14";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-08-05 21:33:18 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "fenrus75";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "1zkr2y5nb1nr22nq8a3zli87iyfasfq6489p7h1k428pv8k45w4f";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
patches = [
|
|
|
|
# Pull upstream patch for ncurses-6.3 compatibility
|
|
|
|
(fetchpatch {
|
|
|
|
name = "ncurses-6.3.patch";
|
|
|
|
url = "https://github.com/fenrus75/powertop/commit/9ef1559a1582f23d599c149601c3a8e06809296c.patch";
|
|
|
|
sha256 = "0qx69f3bwhxgsga9nas8lgrclf1rxvr7fq7fd2n8dv3x4lsb46j1";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
outputs = [ "out" "man" ];
|
|
|
|
|
2021-08-05 21:33:18 +00:00
|
|
|
nativeBuildInputs = [ pkg-config autoreconfHook ];
|
2020-04-24 23:36:52 +00:00
|
|
|
buildInputs = [ gettext libnl ncurses pciutils zlib ];
|
|
|
|
|
2021-08-05 21:33:18 +00:00
|
|
|
NIX_LDFLAGS = [ "-lpthread" ];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace src/main.cpp --replace "/sbin/modprobe" "modprobe"
|
|
|
|
substituteInPlace src/calibrate/calibrate.cpp --replace "/usr/bin/xset" "xset"
|
2020-11-30 08:33:03 +00:00
|
|
|
substituteInPlace src/tuning/bluetooth.cpp --replace "/usr/bin/hcitool" "hcitool"
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Analyze power consumption on Intel-based laptops";
|
|
|
|
homepage = "https://01.org/powertop";
|
2021-10-17 02:12:59 +00:00
|
|
|
license = licenses.gpl2Only;
|
2020-04-24 23:36:52 +00:00
|
|
|
maintainers = with maintainers; [ fpletz ];
|
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|