Correct way to use lm_sensors in NixOS

Hi all,

I want to use lm_sensors to see the temperatures of my system. I used sensors-detect to detect the sensors. It’ll create a /etc/sysconfig/lm_sensors file. I copied the content of this file and deleted the file. In my NixOS I added this to create /etc/sysconfig/lm_sensors:

  environment = {
    etc = {
      "sysconfig/lm_sensors".text = ''
        # Generated by sensors-detect on Sat Nov 21 18:37:56 2020
        # This file is sourced by /etc/init.d/lm_sensors and defines the modules to
        # be loaded/unloaded.
        # The format of this file is a shell script that simply defines variables:
        # HWMON_MODULES for hardware monitoring driver modules, and optionally
        # BUS_MODULES for any required bus driver module (for example for I2C or SPI).


This creates /etc/sysconfig/lm_sensors (a symbolic link to the real file). After switching to this new config I saw that the module nct6775 is not being loaded. I find some NixOS configs where nct6775 is being loaded using the option boot.kernelParams. So I added this to my NixOS config:

boot.kernelModules = [ "kvm-amd" "nct6775" ];

After switching and reboot the nct6775 is being loaded. My question are

1 - /etc/sysconfig/lm_sensors is not being used?
2 - Using boot.kernelModules is the right way?



this may help you.

1 Like

Thanks @nixinator! The first link uses /etc/sysconfig/lm_sensors the other twos use boot.kernelModules. I’ll continue with boot.kernelModules since /etc/sysconfig/lm_sensors is not working.

1 Like