1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-12 07:34:36 +00:00
nixpkgs/modules/tasks/cpu-freq.nix
Eelco Dolstra cc41bce79d * Prevent merging of some options. P.S. maybe string options
should be "uniq" by default.

svn path=/nixos/trunk/; revision=31520
2012-01-13 13:26:52 +00:00

47 lines
932 B
Nix

{ config, pkgs, ... }:
with pkgs.lib;
{
###### interface
options = {
powerManagement.cpuFreqGovernor = mkOption {
default = "";
example = "ondemand";
type = types.uniq types.string;
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.powerManagement.cpuFreqGovernor != "") {
environment.systemPackages = [ pkgs.cpufrequtils ];
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.powerManagement.cpuFreqGovernor} -c $i
done
'';
};
};
}