2021-09-23 19:54:42 +00:00
|
|
|
{ lib, python3Packages, fetchFromGitHub, substituteAll }:
|
2020-12-15 21:47:51 +00:00
|
|
|
|
|
|
|
python3Packages.buildPythonPackage rec {
|
|
|
|
pname = "auto-cpufreq";
|
2021-10-18 12:27:19 +00:00
|
|
|
version = "1.7.1";
|
2020-12-15 21:47:51 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "AdnanHodzic";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2021-10-18 12:27:19 +00:00
|
|
|
sha256 = "1r27ydv258c6pc82za0wq8q8fj0j3r50c8wxc6r7dwr6wx8q3asx";
|
2020-12-15 21:47:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
propagatedBuildInputs = with python3Packages; [ click distro psutil ];
|
|
|
|
|
|
|
|
doCheck = false;
|
2021-01-24 13:47:01 +00:00
|
|
|
pythonImportsCheck = [ "auto_cpufreq" ];
|
2020-12-15 21:47:51 +00:00
|
|
|
|
2021-09-23 19:54:42 +00:00
|
|
|
patches = [
|
|
|
|
# hardcodes version output
|
|
|
|
(substituteAll {
|
|
|
|
src = ./fix-version-output.patch;
|
|
|
|
inherit version;
|
|
|
|
})
|
|
|
|
|
|
|
|
# patch to prevent script copying and to disable install
|
|
|
|
./prevent-install-and-copy.patch
|
|
|
|
];
|
2020-12-15 21:47:51 +00:00
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
# copy script manually
|
2021-01-24 13:47:01 +00:00
|
|
|
cp ${src}/scripts/cpufreqctl.sh $out/bin/cpufreqctl.auto-cpufreq
|
|
|
|
|
|
|
|
# systemd service
|
|
|
|
mkdir -p $out/lib/systemd/system
|
|
|
|
cp ${src}/scripts/auto-cpufreq.service $out/lib/systemd/system
|
|
|
|
substituteInPlace $out/lib/systemd/system/auto-cpufreq.service --replace "/usr/local" $out
|
2020-12-15 21:47:51 +00:00
|
|
|
'';
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2020-12-15 21:47:51 +00:00
|
|
|
homepage = "https://github.com/AdnanHodzic/auto-cpufreq";
|
|
|
|
description = "Automatic CPU speed & power optimizer for Linux";
|
|
|
|
license = licenses.lgpl3Plus;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
maintainers = [ maintainers.Technical27 ];
|
2023-07-31 19:21:43 +00:00
|
|
|
mainProgram = "auto-cpufreq";
|
2020-12-15 21:47:51 +00:00
|
|
|
};
|
|
|
|
}
|