Lm-sensor config in 25.05

Hi all,

when switching to 25.05 beta, my lm_sensor config stopped working:

_: {
  config = {
    environment.etc = {
      "sensors3.conf".text = ''
        chip "nct6795-isa-*"
          ignore fan1
          ignore fan4
          ignore fan5
          ignore in10
          ignore temp4
          ignore temp5
          ignore temp6
          ignore temp8
          ignore temp9
          ignore temp10
          ignore temp11
          ignore temp12
          label fan2 "CPU Fan"
          ignore fan3 #"Case Fan"
        chip "amdgpu-pci-*"
          label fan1 "GPU Fan"
      '';
    };
  };
}

Calling sensors via cli:

sensors
nct6795-isa-0a20
Adapter: ISA adapter
Vcore:                 816.00 mV (min =  +0.00 V, max =  +1.74 V)
in1:                     1.01 V  (min =  +0.00 V, max =  +0.00 V)  ALARM
AVCC:                    3.42 V  (min =  +0.00 V, max =  +0.00 V)  ALARM
+3.3V:                   3.39 V  (min =  +0.00 V, max =  +0.00 V)  ALARM
in4:                     1.02 V  (min =  +0.00 V, max =  +0.00 V)  ALARM
in5:                   160.00 mV (min =  +0.00 V, max =  +0.00 V)  ALARM
in6:                   672.00 mV (min =  +0.00 V, max =  +0.00 V)  ALARM
3VSB:                    3.41 V  (min =  +0.00 V, max =  +0.00 V)  ALARM
Vbat:                    3.33 V  (min =  +0.00 V, max =  +0.00 V)  ALARM
in9:                     1.84 V  (min =  +0.00 V, max =  +0.00 V)  ALARM
in10:                    0.00 V  (min =  +0.00 V, max =  +0.00 V)
in11:                  616.00 mV (min =  +0.00 V, max =  +0.00 V)  ALARM
in12:                    1.01 V  (min =  +0.00 V, max =  +0.00 V)  ALARM
in13:                  680.00 mV (min =  +0.00 V, max =  +0.00 V)  ALARM
in14:                    1.53 V  (min =  +0.00 V, max =  +0.00 V)  ALARM
fan1:                     0 RPM  (min =    0 RPM)
fan2:                   269 RPM  (min =    0 RPM)
fan3:                     0 RPM  (min =    0 RPM)
fan4:                     0 RPM  (min =    0 RPM)
fan5:                     0 RPM  (min =    0 RPM)
SYSTIN:                 +43.0°C  (high =  +0.0°C, hyst =  +0.0°C)  ALARM  sensor = CPU diode
CPUTIN:                 +38.0°C  (high = +115.0°C, hyst = +90.0°C)  sensor = thermistor
AUXTIN0:                +44.5°C  (high = +115.0°C, hyst = +90.0°C)  sensor = thermistor
AUXTIN1:               -128.0°C    sensor = thermistor
AUXTIN2:                +49.0°C    sensor = thermistor
AUXTIN3:                 -2.0°C    sensor = thermistor
SMBUSMASTER 0:          +40.5°C
PCH_CHIP_CPU_MAX_TEMP:   +0.0°C
PCH_CHIP_TEMP:           +0.0°C
PCH_CPU_TEMP:            +0.0°C
PCH_MCH_TEMP:            +0.0°C
Agent0 Dimm0:            +0.0°C
TSI0_TEMP:              +40.9°C
intrusion0:            ALARM
intrusion1:            ALARM
beep_enable:           disabled

nvme-pci-0100
Adapter: PCI adapter
Composite:    +52.9°C  (low  =  -5.2°C, high = +83.8°C)
                       (crit = +87.8°C)

k10temp-pci-00c3
Adapter: PCI adapter
Tctl:         +40.1°C
Tccd1:        +51.0°C

amdgpu-pci-2b00
Adapter: PCI adapter
vddgfx:      862.00 mV
fan1:           0 RPM  (min =    0 RPM, max = 3300 RPM)
edge:         +45.0°C  (crit = +110.0°C, hyst = -273.1°C)
                       (emerg = +115.0°C)
junction:     +51.0°C  (crit = +110.0°C, hyst = -273.1°C)
                       (emerg = +115.0°C)
mem:          +46.0°C  (crit = +105.0°C, hyst = -273.1°C)
                       (emerg = +110.0°C)
PPT:           9.00 W  (cap = 194.00 W)

It works if you provide a full path to the (default) config file:

sensors -c /etc/sensors3.conf
nct6795-isa-0a20
Adapter: ISA adapter
in0:           936.00 mV (min =  +0.00 V, max =  +1.74 V)
in1:             1.01 V  (min =  +0.00 V, max =  +0.00 V)  ALARM
in2:             3.42 V  (min =  +0.00 V, max =  +0.00 V)  ALARM
in3:             3.41 V  (min =  +0.00 V, max =  +0.00 V)  ALARM
in4:             1.02 V  (min =  +0.00 V, max =  +0.00 V)  ALARM
in5:           160.00 mV (min =  +0.00 V, max =  +0.00 V)  ALARM
in6:           672.00 mV (min =  +0.00 V, max =  +0.00 V)  ALARM
in7:             3.41 V  (min =  +0.00 V, max =  +0.00 V)  ALARM
in8:             3.33 V  (min =  +0.00 V, max =  +0.00 V)  ALARM
in9:             1.84 V  (min =  +0.00 V, max =  +0.00 V)  ALARM
in11:          616.00 mV (min =  +0.00 V, max =  +0.00 V)  ALARM
in12:            1.01 V  (min =  +0.00 V, max =  +0.00 V)  ALARM
in13:          680.00 mV (min =  +0.00 V, max =  +0.00 V)  ALARM
in14:            1.53 V  (min =  +0.00 V, max =  +0.00 V)  ALARM
CPU Fan:        268 RPM  (min =    0 RPM)
SYSTIN:         +43.0°C  (high =  +0.0°C, hyst =  +0.0°C)  ALARM  sensor = CPU diode
CPUTIN:         +39.0°C  (high = +115.0°C, hyst = +90.0°C)  sensor = thermistor
AUXTIN0:        +45.0°C  (high = +115.0°C, hyst = +90.0°C)  sensor = thermistor
SMBUSMASTER 0:  +41.0°C
TSI0_TEMP:      +41.4°C
intrusion0:    ALARM
intrusion1:    ALARM
beep_enable:   disabled

nvme-pci-0100
Adapter: PCI adapter
Composite:    +52.9°C  (low  =  -5.2°C, high = +83.8°C)
                       (crit = +87.8°C)

k10temp-pci-00c3
Adapter: PCI adapter
Tctl:         +41.2°C
Tccd1:        +50.5°C

amdgpu-pci-2b00
Adapter: PCI adapter
vddgfx:      862.00 mV
GPU Fan:        0 RPM  (min =    0 RPM, max = 3300 RPM)
edge:         +45.0°C  (crit = +110.0°C, hyst = -273.1°C)
                       (emerg = +115.0°C)
junction:     +52.0°C  (crit = +110.0°C, hyst = -273.1°C)
                       (emerg = +115.0°C)
mem:          +46.0°C  (crit = +105.0°C, hyst = -273.1°C)
                       (emerg = +110.0°C)
PPT:          10.00 W  (cap = 194.00 W)

I also tried different config files without any success:

  • /etc/sensors3.conf (default)
  • /etc/sensors.conf
  • /etc/sensors.d/misc.conf

Has anyone an idea what changed in 25.05 and how I can fix this?

Thanks in advance.

I don’t know if this is the appropriate way to fix this issue or not, but it does work

        (final: prev: {
          sensors = final.lm_sensors.overrideAttrs (oldAttrs: 
          let 
            myconfigfile = ''
              chip "acpitz-acpi-0"
                label temp1 "NewTemp"
            '';
          in {

            postBuild = ''
              mkdir -p ${placeholder "out"}/etc/sensors.d/
              cp ${pkgs.writeText "myconfigfile" myconfigfile} ${placeholder "out"}/etc/sensors.d/;
            '';
          });
        })

I suspect this change is what caused that: lm_sensors: fix build, split outputs, modernize and remove perl from library closure by oxalica · Pull Request #373242 · NixOS/nixpkgs · GitHub

I guess it also affects where it reads the file from at runtime, rather than just where it installs it to. This should be reported upstream, and someone needs to ask the PR author why that was necessary in the first place. If I knew I’d just patch it.

Your workaround obviously gets around this, but you can do it with much less build/eval overhead by skipping the overlay and using symlinkJoin:

{ pkgs, ... }: {
  environment.systemPackages = let
    sensors_config = pkgs.writeTextDir "etc/sensors.d/myconfigfile" ''
      chip "acpitz-acpi-0"
        label temp1 "NewTemp"
    '';
    sensors = pkgs.symlinkJoin {
      inherit (pkgs.sensors) name;
      paths = [
        pkgs.sensors
        sensors_config
      ];
    };
  in [
    sensors
  ];
}

Overriding it does make library dependents also read the correct config, though.

2 Likes