Added cpuFreqGovernor option to configure a CPU frequency governor.
svn path=/nixos/trunk/; revision=30949
This commit is contained in:
parent
52e6088c88
commit
ae82e7b048
2 changed files with 40 additions and 0 deletions
|
@ -190,6 +190,7 @@
|
||||||
./system/upstart-events/runlevel.nix
|
./system/upstart-events/runlevel.nix
|
||||||
./system/upstart-events/shutdown.nix
|
./system/upstart-events/shutdown.nix
|
||||||
./system/upstart/upstart.nix
|
./system/upstart/upstart.nix
|
||||||
|
./tasks/cpu-freq.nix
|
||||||
./tasks/filesystems.nix
|
./tasks/filesystems.nix
|
||||||
./tasks/kbd.nix
|
./tasks/kbd.nix
|
||||||
./tasks/lvm.nix
|
./tasks/lvm.nix
|
||||||
|
|
39
modules/tasks/cpu-freq.nix
Normal file
39
modules/tasks/cpu-freq.nix
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
{ 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
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue