Surface Laptop Go 2 thermald / power management config

Hello all, I’ve found a possible fix for my CPU throttling and temperature issue in some games on NixOS, but I’m not sure exactly how it’s suppose to be loaded. I’m pretty new to NixOS so I’m looking for some pointers.

I’ve turned on power management ( powerManagement.enable = true;), enabled ( services.thermald.enable = true;) and put thermald package in my nix config, but it didn’t seem to help on it’s own. The link below says that the config files need to be copied into etc/thermald/ to set the proper config.

Seems like the config needs to be loaded into a package? I don’t think I can just load the files into the folder, from what I understand.

Also, here is another link on the topic, just not NixOS specific.

https://www.reddit.com/r/SurfaceLinux/comments/xcjgyo/surface_go_3_overheating/

Thanks

P.S. I know it’s just power management issues in NixOS as Windows doesn’t have any issues on the same device.

I believe you would want to set the services.thermald.configFile parameter.

Note that this parameter is what the nixos module system calls a “path”, which means it can be a string (naming an absolute path) or a path. If you specify it as a string, that string will be used verbatim, and you should ensure the file is available at that path — nix will not manage it for you. If you reference it as a path, nix will copy the file into the nix store, and that path to the file in the nix store is what will be present in the Systemd configuration file nix generates.

For example, if you had the following in in your configuration.nix:

services.thermald.configFile = "/var/lib/thermald/thermald.conf";

thermald would use whatever file is present at /var/lib/thermald/thermald.conf, and probably issue a warning or refuse to start entirely if the file did not exist.

On the other hand, if you had thermald.conf in the same directory as your configuration.nix file and had the following configuration:

services.thermald.configFile = ./thermald.conf;

on the next nixos-rebuild, nix would copy thermald.conf into the store, and reference that file.

1 Like