1
1
Fork 0
nixos/options/custom/services/auto-cpufreq.nix
Myned e5c5604448
auto-cpufreq: allow integers for frequency
Signed-off-by: Myned <dev@bjork.tech>
2024-10-30 09:44:12 -05:00

51 lines
1.5 KiB
Nix

{
config,
lib,
...
}:
with lib; let
cfg = config.custom.services.auto-cpufreq;
in {
options.custom.services.auto-cpufreq = {
enable = mkOption {default = false;};
max = {
battery = mkOption {default = null;}; # GHz
charger = mkOption {default = null;}; # GHz
};
};
config = mkIf cfg.enable {
# https://github.com/AdnanHodzic/auto-cpufreq
#?? auto-cpufreq --stats
#?? cpu-power freqency-info
#?? grep '' /sys/devices/system/cpu/cpu0/cpufreq/*
services = {
auto-cpufreq = {
enable = true;
# https://github.com/AdnanHodzic/auto-cpufreq/blob/master/auto-cpufreq.conf-example
settings = {
battery = {
energy_performance_preference = "balance_power";
governor = "powersave";
platform_profile = "low-power";
scaling_max_freq = mkIf (isFloat cfg.max.battery || isInt cfg.max.battery) (builtins.floor (cfg.max.battery * 1000 * 1000)); # KHz
#// turbo = "never"; # Only works with acpi-cpufreq
};
charger = {
energy_performance_preference = "balance_performance";
governor = "powersave";
platform_profile = "balanced";
scaling_max_freq = mkIf (isFloat cfg.max.charger || isInt cfg.max.charger) (builtins.floor (cfg.max.charger * 1000 * 1000)); # KHz
};
};
};
#!! Conflicts with auto-cpufreq
power-profiles-daemon.enable = false;
tlp.enable = false;
};
};
}