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