Skip to content
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

nixos/thinkfan: use non-deprecated keywords in config file. #40768

Merged
merged 2 commits into from Jul 20, 2018

Conversation

CommunicationAnimale
Copy link
Contributor

Motivation for this change

Currently, the thinkfan config written by nix is not being correctly read as it uses the deprecated keyword sensor (see https://man.cx/thinkfan(1)). For instance, if I add the following expression to my configuration.nix file:

services.thinkfan = {
  enable = true;
  sensor = "/sys/devices/virtual/hwmon/hwmon0/temp1_input";
};

thinkfan will print error messages in journalctl:

May 19 11:38:29 nixos thinkfan[1067]: thinkfan 0.9.1 starting...
May 19 11:38:29 nixos systemd[1]: Started Thinkfan.
May 19 11:38:29 nixos thinkfan[1067]: /nix/store/sj9nqnwyjk36g7q8mq6iyy1dhv2wmjck-thinkfan.conf:35:sensor /sys/devices/virtual/hwmon/hwmon0/temp1_input (0, 10, 15, >
May 19 11:38:29 nixos thinkfan[1067]: WARNING: The `sensor' keyword is deprecated. Please use the `hwmon' or `tp_thermal' keywords instead!

What's more, thinkfan may read temperatures from multiple sensors, and offers an option to specify the fan.

Things done

The change is breaking. However since the previous way of doing it does not really work in practice I think it is the way to go.

I modified the configuration options of the thinkfan service to allow multiple thermal sensors (in services.thinkfan.sensors) and removed the hard-coded sensor keyword.

To note:

  1. in the description of the keyword sensor, I noted that thinkfan may monitor hard drives temperatures if it had been compiled with the USE_ATASMART file, but I didn't enable this flag because thinkfan author's notes : "Enable libatasmart to read temperatures directly from hard disks. Use this only when you really need it, since libatasmart is unreasonably CPU-intensive."

  2. I did not test these changes, I do not know how to test services.

  3. Maybe it would be better to leave the defaults empty: an incorrect configuration for a given system may lead to overheating (and permanent damage). Nevertheless, I left it the way it was, I expect thinkfan users to be quite knowledgeable, and defaults may therefore serve as examples.

  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@coretemp
Copy link
Contributor

I think it would be nice if people wouldn't have to specify/configure this module at all.

I also have /sys/devices/virtual/hwmon/hwmon0/temp1_input available, and it should be possible to let the service at boot figure out whether that file exists and if so, to use that as a default file location. In general, it should be possible for other people to also contribute to this with their configurations, such that at some point all of this just works without user configuration (because the module already does all the configuration).

Having said that, I do think this is an improvement on the status quo.

@coretemp
Copy link
Contributor

See also #40452

Copy link
Member

@pSub pSub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. I'm using it since several weeks now. If there are no objections, I would like to merge this in the next days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants