diff options
author | (cdep)illabout <cdep.illabout@gmail.com> | 2019-01-03 20:57:49 +0900 |
---|---|---|
committer | (cdep)illabout <cdep.illabout@gmail.com> | 2019-01-03 20:57:49 +0900 |
commit | 46ecec8239bb540f9031fde63e475905de77e5a1 (patch) | |
tree | c8eed641f8ec67faa8af9d231a4634764ea4153c /nixos/modules/tasks/cpu-freq.nix | |
parent | e33d6364f694d8beadd8687de9e96dbd70605b24 (diff) | |
download | nixpkgs-46ecec8239bb540f9031fde63e475905de77e5a1.tar nixpkgs-46ecec8239bb540f9031fde63e475905de77e5a1.tar.gz nixpkgs-46ecec8239bb540f9031fde63e475905de77e5a1.tar.bz2 nixpkgs-46ecec8239bb540f9031fde63e475905de77e5a1.tar.lz nixpkgs-46ecec8239bb540f9031fde63e475905de77e5a1.tar.xz nixpkgs-46ecec8239bb540f9031fde63e475905de77e5a1.tar.zst nixpkgs-46ecec8239bb540f9031fde63e475905de77e5a1.zip |
nixos/cpufreq: Remove the alias to set the cpu frequency governor
This PR temporarily fixes the issue with PR 53041 as explained here: https://github.com/NixOS/nixpkgs/pull/53041#commitcomment-31825338 The alias `powerManagement.cpufreq.governor` to `powerManagement.cpuFreqGovernor` has been removed.
Diffstat (limited to 'nixos/modules/tasks/cpu-freq.nix')
-rw-r--r-- | nixos/modules/tasks/cpu-freq.nix | 57 |
1 files changed, 31 insertions, 26 deletions
diff --git a/nixos/modules/tasks/cpu-freq.nix b/nixos/modules/tasks/cpu-freq.nix index 684c43a1e90..513382936e4 100644 --- a/nixos/modules/tasks/cpu-freq.nix +++ b/nixos/modules/tasks/cpu-freq.nix @@ -4,44 +4,49 @@ with lib; let cpupower = config.boot.kernelPackages.cpupower; - cfg = config.powerManagement.cpufreq; + cfg = config.powerManagement; in { ###### interface - options.powerManagement.cpufreq = { + options.powerManagement = { - governor = mkOption { + # TODO: This should be aliased to powerManagement.cpufreq.governor. + # https://github.com/NixOS/nixpkgs/pull/53041#commitcomment-31825338 + cpuFreqGovernor = mkOption { type = types.nullOr types.str; default = null; example = "ondemand"; description = '' Configure the governor used to regulate the frequence of the available CPUs. By default, the kernel configures the - performance governor, although this may be overwriten in your + performance governor, although this may be overwritten in your hardware-configuration.nix file. Often used values: "ondemand", "powersave", "performance" ''; }; - max = mkOption { - type = types.nullOr types.ints.unsigned; - default = null; - example = 2200000; - description = '' - The maximum frequency the CPU will use. Defaults to the maximum possible. - ''; - }; + cpufreq = { - min = mkOption { - type = types.nullOr types.ints.unsigned; - default = null; - example = 800000; - description = '' - The minimum frequency the CPU will use. - ''; + max = mkOption { + type = types.nullOr types.ints.unsigned; + default = null; + example = 2200000; + description = '' + The maximum frequency the CPU will use. Defaults to the maximum possible. + ''; + }; + + min = mkOption { + type = types.nullOr types.ints.unsigned; + default = null; + example = 800000; + description = '' + The minimum frequency the CPU will use. + ''; + }; }; }; @@ -51,16 +56,16 @@ in config = let - governorEnable = cfg.governor != null; - maxEnable = cfg.max != null; - minEnable = cfg.min != null; + governorEnable = cfg.cpuFreqGovernor != null; + maxEnable = cfg.cpufreq.max != null; + minEnable = cfg.cpufreq.min != null; enable = !config.boot.isContainer && (governorEnable || maxEnable || minEnable); in mkIf enable { - boot.kernelModules = optional governorEnable "cpufreq_${cfg.governor}"; + boot.kernelModules = optional governorEnable "cpufreq_${cfg.cpuFreqGovernor}"; environment.systemPackages = [ cpupower ]; @@ -74,9 +79,9 @@ in Type = "oneshot"; RemainAfterExit = "yes"; ExecStart = "${cpupower}/bin/cpupower frequency-set " + - optionalString governorEnable "--governor ${cfg.governor} " + - optionalString maxEnable "--max ${toString cfg.max} " + - optionalString minEnable "--min ${toString cfg.min} "; + optionalString governorEnable "--governor ${cfg.cpuFreqGovernor} " + + optionalString maxEnable "--max ${toString cfg.cpufreq.max} " + + optionalString minEnable "--min ${toString cfg.cpufreq.min} "; SuccessExitStatus = "0 237"; }; }; |