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