2023-01-11 07:51:40 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, gettext
|
|
|
|
, libnl
|
|
|
|
, ncurses
|
|
|
|
, pciutils
|
|
|
|
, pkg-config
|
|
|
|
, zlib
|
|
|
|
, autoreconfHook
|
|
|
|
, autoconf-archive
|
|
|
|
, nix-update-script
|
|
|
|
, testers
|
|
|
|
, powertop
|
2023-04-29 16:46:19 +00:00
|
|
|
, xorg
|
2023-01-11 07:51:40 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "powertop";
|
2023-01-11 07:51:40 +00:00
|
|
|
version = "2.15";
|
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}";
|
2023-01-11 07:51:40 +00:00
|
|
|
hash = "sha256-53jfqt0dtMqMj3W3m6ravUTzApLQcljDHfdXejeZa4M=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
outputs = [ "out" "man" ];
|
|
|
|
|
2023-01-11 07:51:40 +00:00
|
|
|
nativeBuildInputs = [ pkg-config autoreconfHook autoconf-archive ];
|
2020-04-24 23:36:52 +00:00
|
|
|
buildInputs = [ gettext libnl ncurses pciutils zlib ];
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace src/main.cpp --replace "/sbin/modprobe" "modprobe"
|
2023-04-29 16:46:19 +00:00
|
|
|
substituteInPlace src/calibrate/calibrate.cpp --replace "/usr/bin/xset" "${lib.getExe xorg.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
|
|
|
'';
|
|
|
|
|
2023-01-11 07:51:40 +00:00
|
|
|
passthru = {
|
|
|
|
updateScript = nix-update-script { };
|
|
|
|
tests.version = testers.testVersion {
|
|
|
|
package = powertop;
|
|
|
|
command = "powertop --version";
|
|
|
|
inherit version;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2023-01-11 07:51:40 +00:00
|
|
|
inherit (src.meta) homepage;
|
|
|
|
changelog = "https://github.com/fenrus75/powertop/releases/tag/v${version}";
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Analyze power consumption on Intel-based laptops";
|
2021-10-17 02:12:59 +00:00
|
|
|
license = licenses.gpl2Only;
|
2023-01-11 07:51:40 +00:00
|
|
|
maintainers = with maintainers; [ fpletz anthonyroussel ];
|
2020-04-24 23:36:52 +00:00
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|