New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add nixos cpufreq max min options #53041
Add nixos cpufreq max min options #53041
Conversation
7b0028b
to
fe86dbb
Compare
Nice, now the only thing left to do is squash the changes into 1 or 2 commits (one for the option rename and another for the rest), whatever you prefer |
383fbfb
to
475b945
Compare
@infinisil I've squashed this into one commit: 475b945. I thought this would be easier than trying to separate it into two commits. This should be ready to be merged. |
Oh actually, I haven't thought of this but this change will actually issue a warning for most NixOS users, and there's been some push against that, see #44107 So I think maybe an alias option is better. |
475b945
to
49102f3
Compare
@infinisil I've changed the option from a rename to an alias in commit f6873e24132. This PR should now be ready for a final review and merge. |
4fde351
to
f6873e2
Compare
The <option>powerManagement.cpuFreqGovernor</option> option has been | ||
aliased to <option>powerManagement.cpufreq.governor</option>. On laptops, | ||
<option>powerManagement.cpuFreqGovernor</option> is sometimes set in | ||
<literal>/etc/nixos/hardware.nix</literal>, so you can rename it to the new |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/hardware.nix/hardware-configuration.nix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I thought I had fixed that in a previous rebase.
Fixed in commit b0f10d2.
This adds a NixOS option for setting the CPU max and min frequencies with `cpufreq`. The two options that have been added are: - `powerManagement.cpufreq.max` - `powerManagement.cpufreq.min` It also adds an alias to the `powerManagement.cpuFreqGovernor` option as `powerManagement.cpufreq.governor`. This updates the installer to use the new option name. It also updates the manual with a note about the new name.
f6873e2
to
b0f10d2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@infinisil Thanks for working with me on this and giving your approval. Could this be merged into |
@cdepillabout Ah darn. Well I think the normal mkAliasOptionModule should propagate priorities as well, so this is like 1. But this might take a while to test properly with all existing aliases (does it break other things?), so I suggest going with 2 instead for now. We can add the alias back in later. |
@infinisil Okay, sounds good. I'll go ahead and send two pull requests:
If we are able to successfully merge 2, then I'll send a third PR adding back the |
This PR temporarily fixes the issue with PR 53041 as explained here: #53041 (comment) The alias `powerManagement.cpufreq.governor` to `powerManagement.cpuFreqGovernor` has been removed.
…he priority This commit adds a function `mkAliasOptionModuleWithPriority`. This function will make an alias to an existing option and copy over the priority. This functionality is needed for PRs like NixOS#53041. In that case `nixos-generate-config` added an option to `hardware-configuration.nix` with `mkDefault`. That option was then changed and an alias created for the old name. The end user should be able to set the non-alias option in their `configuration.nix` and have everything work correctly. Without this function, the priority for the option won't be copied over correctly and the end-user will get a message saying they have the same option set to two different values.
Motivation for this change
This adds a NixOS option for setting the CPU max and min frequencies with
cpufreq
. The two options that have been added are:powerManagement.cpufreq.max
powerManagement.cpufreq.min
It also renames the
powerManagement.cpuFreqGovernor
option topowerManagement.cpufreq.governor
. I could update this to be a module alias instead of a module rename if that would be preferred.This updates the installer to use the new option name. It also updates the manual for with a note about the new name.
I think it makes the most sense to have
powerManagement.cpufreq.{governor, max, min}
instead of the optionspowerManagement.{cpuFreqGovernor, cpuFreqMax, cpuFreqMin}
, but I'd be okay with either one.Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)nix path-info -S
before and after)