nix-git/hosts/yodaTuxHeadless/cpu-fixed-frequency.nix

30 lines
770 B
Nix

{ config, pkgs, lib, ... }:
{
#
# Pin CPU frequency
#
# https://unix.stackexchange.com/a/265611
# See current speed of each core:
# watch -n.1 "grep \"^[c]pu MHz\" /proc/cpuinfo"
#
# https://wiki.archlinux.org/title/CPU_frequency_scaling#Userspace_tools
# Gnome uses power-profiles-daemon wich conflicts with tlp.
# https://discourse.nixos.org/t/cant-enable-tlp-when-upgrading-to-21-05/13435/3
services.power-profiles-daemon.enable = false;
services.tlp = {
enable = true;
# https://linrunner.de/tlp/settings/processor.html
settings = {
CPU_SCALING_MIN_FREQ_ON_AC = 1400000;
CPU_SCALING_MAX_FREQ_ON_AC = 1400000;
# Probably useless whenn setting fixed CPU freq above.
CPU_BOOST_ON_AC = 0;
};
};
}