2023-10-13 16:31:59 +02:00
|
|
|
{
|
|
|
|
lib,
|
2024-04-30 08:35:53 +02:00
|
|
|
python3Packages,
|
2023-10-13 16:31:59 +02:00
|
|
|
pkgs,
|
2024-04-10 06:57:05 +02:00
|
|
|
fetchFromGitHub,
|
2024-05-22 01:43:05 +02:00
|
|
|
fetchPypi,
|
2023-10-13 16:31:59 +02:00
|
|
|
}:
|
2024-04-10 06:57:05 +02:00
|
|
|
let
|
2024-04-30 08:35:53 +02:00
|
|
|
|
|
|
|
pyinotify = python3Packages.pyinotify.overrideAttrs (oldAttrs: {
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "shadeyg56";
|
|
|
|
repo = "pyinotify-3.12";
|
|
|
|
rev = "923cebec3a2a84c7e38c9e68171eb93f5d07ce5d";
|
|
|
|
hash = "sha256-714CximEK4YhIqDmvqJYOUGs39gvDkWGrkNrXwxT8iM=";
|
|
|
|
};
|
2024-07-23 20:36:50 +02:00
|
|
|
patches = [];
|
2024-04-30 08:35:53 +02:00
|
|
|
});
|
|
|
|
|
2024-04-10 06:57:05 +02:00
|
|
|
in
|
2024-04-30 08:35:53 +02:00
|
|
|
python3Packages.buildPythonPackage {
|
2023-10-13 08:04:49 +02:00
|
|
|
# use pyproject.toml instead of setup.py
|
|
|
|
format = "pyproject";
|
2023-09-16 11:36:01 +02:00
|
|
|
|
2023-10-13 08:04:49 +02:00
|
|
|
pname = "auto-cpufreq";
|
2024-05-09 10:07:52 +02:00
|
|
|
version = "2.3.0";
|
2023-09-16 11:36:01 +02:00
|
|
|
src = ../.;
|
|
|
|
|
2023-10-13 16:31:59 +02:00
|
|
|
nativeBuildInputs = with pkgs; [wrapGAppsHook gobject-introspection];
|
2023-10-13 08:04:49 +02:00
|
|
|
|
2024-04-30 08:35:53 +02:00
|
|
|
buildInputs = with pkgs; [gtk3 python3Packages.poetry-core];
|
2023-09-16 11:36:01 +02:00
|
|
|
|
2024-05-22 05:49:41 +02:00
|
|
|
propagatedBuildInputs = with python3Packages; [requests pygobject3 click distro psutil setuptools poetry-dynamic-versioning pyinotify pkgs.getent];
|
2023-09-16 11:36:01 +02:00
|
|
|
|
|
|
|
doCheck = false;
|
2023-10-13 16:31:59 +02:00
|
|
|
pythonImportsCheck = ["auto_cpufreq"];
|
2023-09-16 11:36:01 +02:00
|
|
|
|
|
|
|
patches = [
|
2023-10-13 16:31:59 +02:00
|
|
|
# patch to prevent script copying and to disable install
|
2023-09-16 11:36:01 +02:00
|
|
|
./patches/prevent-install-and-copy.patch
|
|
|
|
];
|
|
|
|
|
|
|
|
postPatch = ''
|
2024-06-03 23:56:10 +02:00
|
|
|
substituteInPlace auto_cpufreq/core.py --replace-fail '/opt/auto-cpufreq/override.pickle' /var/run/override.pickle
|
|
|
|
substituteInPlace scripts/org.auto-cpufreq.pkexec.policy --replace-fail "/opt/auto-cpufreq/venv/bin/auto-cpufreq" $out/bin/auto-cpufreq
|
2023-10-13 16:31:59 +02:00
|
|
|
|
2024-06-03 23:56:10 +02:00
|
|
|
substituteInPlace auto_cpufreq/gui/app.py auto_cpufreq/gui/objects.py --replace-fail "/usr/local/share/auto-cpufreq/images/icon.png" $out/share/pixmaps/auto-cpufreq.png
|
|
|
|
substituteInPlace auto_cpufreq/gui/app.py --replace-fail "/usr/local/share/auto-cpufreq/scripts/style.css" $out/share/auto-cpufreq/scripts/style.css
|
2023-09-16 11:36:01 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
# copy script manually
|
|
|
|
cp scripts/cpufreqctl.sh $out/bin/cpufreqctl.auto-cpufreq
|
|
|
|
|
2023-10-13 16:31:59 +02:00
|
|
|
# move the css to the rihgt place
|
|
|
|
mkdir -p $out/share/auto-cpufreq/scripts
|
|
|
|
cp scripts/style.css $out/share/auto-cpufreq/scripts/style.css
|
|
|
|
|
2023-09-16 11:36:01 +02:00
|
|
|
# systemd service
|
|
|
|
mkdir -p $out/lib/systemd/system
|
|
|
|
cp scripts/auto-cpufreq.service $out/lib/systemd/system
|
|
|
|
|
|
|
|
# desktop icon
|
|
|
|
mkdir -p $out/share/applications
|
|
|
|
mkdir $out/share/pixmaps
|
|
|
|
cp scripts/auto-cpufreq-gtk.desktop $out/share/applications
|
|
|
|
cp images/icon.png $out/share/pixmaps/auto-cpufreq.png
|
|
|
|
|
|
|
|
# polkit policy
|
|
|
|
mkdir -p $out/share/polkit-1/actions
|
|
|
|
cp scripts/org.auto-cpufreq.pkexec.policy $out/share/polkit-1/actions
|
|
|
|
'';
|
|
|
|
|
2024-06-03 23:56:10 +02:00
|
|
|
meta = {
|
2023-09-16 11:36:01 +02:00
|
|
|
homepage = "https://github.com/AdnanHodzic/auto-cpufreq";
|
|
|
|
description = "Automatic CPU speed & power optimizer for Linux";
|
2024-06-03 23:56:10 +02:00
|
|
|
license = lib.licenses.lgpl3Plus;
|
|
|
|
platforms = lib.platforms.linux;
|
|
|
|
maintainers = with lib.maintainers; [Technical27];
|
2023-09-16 11:36:01 +02:00
|
|
|
mainProgram = "auto-cpufreq";
|
|
|
|
};
|
|
|
|
}
|