2021-11-18 22:10:08 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, fetchpatch, gettext, libnl, ncurses, pciutils
|
2021-07-28 20:19:32 +00:00
|
|
|
, pkg-config, zlib, autoreconfHook }:
|
2007-09-23 10:59:54 +00:00
|
|
|
|
2012-06-11 10:28:21 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2019-01-05 06:37:56 +00:00
|
|
|
pname = "powertop";
|
2021-07-28 20:19:32 +00:00
|
|
|
version = "2.14";
|
2013-01-15 17:43:53 +00:00
|
|
|
|
2021-07-28 20:19:32 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "fenrus75";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "1zkr2y5nb1nr22nq8a3zli87iyfasfq6489p7h1k428pv8k45w4f";
|
2007-09-23 10:59:54 +00:00
|
|
|
};
|
2012-06-11 10:28:21 +00:00
|
|
|
|
2021-11-18 22:10:08 +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";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2018-02-19 11:14:42 +00:00
|
|
|
outputs = [ "out" "man" ];
|
|
|
|
|
2021-07-28 20:19:32 +00:00
|
|
|
nativeBuildInputs = [ pkg-config autoreconfHook ];
|
2016-10-13 20:01:59 +00:00
|
|
|
buildInputs = [ gettext libnl ncurses pciutils zlib ];
|
2012-06-11 10:28:21 +00:00
|
|
|
|
2021-07-28 20:19:32 +00:00
|
|
|
NIX_LDFLAGS = [ "-lpthread" ];
|
|
|
|
|
2015-10-15 18:25:43 +00:00
|
|
|
postPatch = ''
|
2015-07-08 12:10:33 +00:00
|
|
|
substituteInPlace src/main.cpp --replace "/sbin/modprobe" "modprobe"
|
2016-01-31 20:40:05 +00:00
|
|
|
substituteInPlace src/calibrate/calibrate.cpp --replace "/usr/bin/xset" "xset"
|
2020-10-17 21:43:23 +00:00
|
|
|
substituteInPlace src/tuning/bluetooth.cpp --replace "/usr/bin/hcitool" "hcitool"
|
2015-07-08 12:10:33 +00:00
|
|
|
'';
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2011-10-13 08:53:47 +00:00
|
|
|
description = "Analyze power consumption on Intel-based laptops";
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://01.org/powertop";
|
2021-10-15 03:19:03 +00:00
|
|
|
license = licenses.gpl2Only;
|
2019-02-22 15:14:13 +00:00
|
|
|
maintainers = with maintainers; [ fpletz ];
|
2016-10-13 20:01:59 +00:00
|
|
|
platforms = platforms.linux;
|
2011-10-13 08:53:47 +00:00
|
|
|
};
|
2007-09-23 10:59:54 +00:00
|
|
|
}
|