2021-09-26 12:46:18 +00:00
|
|
|
{ lib, python3Packages, fetchFromGitHub, substituteAll }:
|
2021-01-09 10:05:03 +00:00
|
|
|
|
|
|
|
python3Packages.buildPythonPackage rec {
|
|
|
|
pname = "auto-cpufreq";
|
2023-10-09 19:29:22 +00:00
|
|
|
version = "1.9.9";
|
2021-01-09 10:05:03 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "AdnanHodzic";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2023-10-09 19:29:22 +00:00
|
|
|
sha256 = "sha256-D/5pwE2V+yXj92ECOUcl/dajMDbvVdz9YNJrl2Pzvts=";
|
2021-01-09 10:05:03 +00:00
|
|
|
};
|
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
propagatedBuildInputs = with python3Packages; [ setuptools-git-versioning click distro psutil ];
|
2021-01-09 10:05:03 +00:00
|
|
|
|
|
|
|
doCheck = false;
|
2021-02-05 17:12:51 +00:00
|
|
|
pythonImportsCheck = [ "auto_cpufreq" ];
|
2021-01-09 10:05:03 +00:00
|
|
|
|
2021-09-26 12:46:18 +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
|
2023-10-09 19:29:22 +00:00
|
|
|
# patch to prevent update
|
|
|
|
./prevent-update.patch
|
2021-09-26 12:46:18 +00:00
|
|
|
];
|
2021-01-09 10:05:03 +00:00
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
# copy script manually
|
2021-02-05 17:12:51 +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
|
2021-01-09 10:05:03 +00:00
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2023-10-09 19:29:22 +00:00
|
|
|
mainProgram = "${pname}";
|
2021-01-09 10:05:03 +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 ];
|
|
|
|
};
|
|
|
|
}
|