diff options
author | Silvan Mosberger <infinisil@icloud.com> | 2019-01-03 17:47:53 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-03 17:47:53 +0100 |
commit | 2b1c9fd8a7a7d74520dd713316ccae42f024a9cf (patch) | |
tree | 5d6247fdb97301022ed7f05dd320b24e4b968142 /nixos/modules | |
parent | 80460ace1170d87b4082b6b505f8be59a048e318 (diff) | |
parent | 46ecec8239bb540f9031fde63e475905de77e5a1 (diff) | |
download | nixpkgs-2b1c9fd8a7a7d74520dd713316ccae42f024a9cf.tar nixpkgs-2b1c9fd8a7a7d74520dd713316ccae42f024a9cf.tar.gz nixpkgs-2b1c9fd8a7a7d74520dd713316ccae42f024a9cf.tar.bz2 nixpkgs-2b1c9fd8a7a7d74520dd713316ccae42f024a9cf.tar.lz nixpkgs-2b1c9fd8a7a7d74520dd713316ccae42f024a9cf.tar.xz nixpkgs-2b1c9fd8a7a7d74520dd713316ccae42f024a9cf.tar.zst nixpkgs-2b1c9fd8a7a7d74520dd713316ccae42f024a9cf.zip |
Merge pull request #53301 from cdepillabout/remove-cpufreqgov-alias
nixos/cpufreq: Remove the alias to set the cpu frequency governor
Diffstat (limited to 'nixos/modules')
-rw-r--r-- | nixos/modules/installer/tools/nixos-generate-config.pl | 2 | ||||
-rw-r--r-- | nixos/modules/rename.nix | 3 | ||||
-rw-r--r-- | nixos/modules/services/hardware/tlp.nix | 2 | ||||
-rw-r--r-- | nixos/modules/tasks/cpu-freq.nix | 57 |
4 files changed, 33 insertions, 31 deletions
diff --git a/nixos/modules/installer/tools/nixos-generate-config.pl b/nixos/modules/installer/tools/nixos-generate-config.pl index fa01dc7bbaf..52a129b39bc 100644 --- a/nixos/modules/installer/tools/nixos-generate-config.pl +++ b/nixos/modules/installer/tools/nixos-generate-config.pl @@ -104,7 +104,7 @@ if (-e "/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors") { foreach $e (@desired_governors) { if (index($governors, $e) != -1) { - last if (push @attrs, "powerManagement.cpufreq.governor = lib.mkDefault \"$e\";"); + last if (push @attrs, "powerManagement.cpuFreqGovernor = lib.mkDefault \"$e\";"); } } } diff --git a/nixos/modules/rename.nix b/nixos/modules/rename.nix index 0ed0f4ac209..dc0a175d5bb 100644 --- a/nixos/modules/rename.nix +++ b/nixos/modules/rename.nix @@ -286,9 +286,6 @@ with lib; (mkRenamedOptionModule [ "hardware" "ckb" "enable" ] [ "hardware" "ckb-next" "enable" ]) (mkRenamedOptionModule [ "hardware" "ckb" "package" ] [ "hardware" "ckb-next" "package" ]) - # cpufeq - (mkAliasOptionModule [ "powerManagement" "cpuFreqGovernor" ] [ "powerManagement" "cpufreq" "governor" ]) - ] ++ (flip map [ "blackboxExporter" "collectdExporter" "fritzboxExporter" "jsonExporter" "minioExporter" "nginxExporter" "nodeExporter" "snmpExporter" "unifiExporter" "varnishExporter" ] diff --git a/nixos/modules/services/hardware/tlp.nix b/nixos/modules/services/hardware/tlp.nix index bbc5b5b80a0..b894025c0fd 100644 --- a/nixos/modules/services/hardware/tlp.nix +++ b/nixos/modules/services/hardware/tlp.nix @@ -55,7 +55,7 @@ in config = mkIf cfg.enable { powerManagement.scsiLinkPolicy = null; - powerManagement.cpufreq.governor = null; + powerManagement.cpuFreqGovernor = null; powerManagement.cpufreq.max = null; powerManagement.cpufreq.min = null; 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"; }; }; |