2023-01-06 06:52:49 +03:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, gettext
|
|
|
|
, libnl
|
|
|
|
, ncurses
|
|
|
|
, pciutils
|
|
|
|
, pkg-config
|
|
|
|
, zlib
|
|
|
|
, autoreconfHook
|
|
|
|
, autoconf-archive
|
|
|
|
, nix-update-script
|
|
|
|
, testers
|
|
|
|
, powertop
|
2023-04-16 15:38:02 +03:00
|
|
|
, xorg
|
2023-01-06 06:52:49 +03:00
|
|
|
}:
|
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";
|
2023-01-06 06:51:44 +03:00
|
|
|
version = "2.15";
|
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}";
|
2023-01-06 06:51:44 +03:00
|
|
|
hash = "sha256-53jfqt0dtMqMj3W3m6ravUTzApLQcljDHfdXejeZa4M=";
|
2007-09-23 14:59:54 +04:00
|
|
|
};
|
2012-06-11 14:28:21 +04:00
|
|
|
|
2018-02-19 14:14:42 +03:00
|
|
|
outputs = [ "out" "man" ];
|
|
|
|
|
2023-01-06 06:51:44 +03:00
|
|
|
nativeBuildInputs = [ pkg-config autoreconfHook autoconf-archive ];
|
2016-10-13 23:01:59 +03:00
|
|
|
buildInputs = [ gettext libnl ncurses pciutils zlib ];
|
2012-06-11 14:28:21 +04:00
|
|
|
|
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"
|
2023-04-16 15:38:02 +03:00
|
|
|
substituteInPlace src/calibrate/calibrate.cpp --replace "/usr/bin/xset" "${lib.getExe xorg.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
|
|
|
'';
|
|
|
|
|
2023-01-06 06:51:44 +03:00
|
|
|
passthru = {
|
|
|
|
updateScript = nix-update-script { };
|
|
|
|
tests.version = testers.testVersion {
|
|
|
|
package = powertop;
|
|
|
|
command = "powertop --version";
|
|
|
|
inherit version;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2021-01-11 10:54:33 +03:00
|
|
|
meta = with lib; {
|
2023-01-06 06:51:44 +03:00
|
|
|
inherit (src.meta) homepage;
|
|
|
|
changelog = "https://github.com/fenrus75/powertop/releases/tag/v${version}";
|
2011-10-13 12:53:47 +04:00
|
|
|
description = "Analyze power consumption on Intel-based laptops";
|
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
|
|
|
}
|