mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-16 06:45:16 +01:00
ae82e7b048
svn path=/nixos/trunk/; revision=30949
39 lines
775 B
Nix
39 lines
775 B
Nix
{ config, pkgs, ... }:
|
|
|
|
with pkgs.lib;
|
|
|
|
{
|
|
###### interface
|
|
|
|
options = {
|
|
cpuFreqGovernor = mkOption {
|
|
default = "";
|
|
example = "ondemand";
|
|
description = ''
|
|
Configure the governor used to regulate the frequence of the
|
|
available CPUs. By default, the kernel configures the governor
|
|
"userspace".
|
|
'';
|
|
};
|
|
};
|
|
|
|
|
|
###### implementation
|
|
|
|
config = mkIf (config.cpuFreqGovernor != "") ({
|
|
jobs.cpuFreq =
|
|
{ description = "Initialize CPU frequency governor";
|
|
|
|
startOn = "started udev";
|
|
|
|
task = true;
|
|
|
|
script = ''
|
|
for i in $(seq 0 $(($(nproc) - 1))); do
|
|
${pkgs.cpufrequtils}/bin/cpufreq-set -g ${config.cpuFreqGovernor} -c $i
|
|
done
|
|
'';
|
|
};
|
|
});
|
|
|
|
}
|