Fan keeps spinning with a base installation of NixOS

I’ve had both software and hardware reasons for spinning fan on Lenovo Ideapd Z510. Eventually fan was replaced, but low-power mode is still nice to have. See my low-power module:

{ config, pkgs, lib, ... }:
{
  hardware.cpu.intel.updateMicrocode = true;
  hardware.enableAllFirmware = true;

  boot.kernelModules = [ "coretemp" ];

  powerManagement.cpuFreqGovernor = "powersave";
  powerManagement.powertop.enable = true;

  # uncomment to lower CPU frequeuncy (0 - lowest, 100 - highest)
  # if it spins even on lowest frequency, then this can be hardware problem

  # system.activationScripts.cpu-frequency-set = {
  #     text = ''
  #         echo 75 > /sys/devices/system/cpu/intel_pstate/max_perf_pct
  #         # check freq with    "sudo cpupower frequency-info"
  #     '';
  #     deps = [];
  # };

  services.thermald.enable = true;
  environment.etc."sysconfig/lm_sensors".text = ''
    # Generated by sensors-detect on Tue Aug  7 10:54:09 2018
    # 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).

    HWMON_MODULES="coretemp"
  '';
}
7 Likes