Change:
default = ""; description = "Additional configuration variables for TLP"; }; }; }; ###### implementation config = mkIf cfg.enable { <ins> boot.kernelModules = [ "msr" ]; </ins> <del> powerManagement.scsiLinkPolicy = null; powerManagement.cpuFreqGovernor = null; powerManagement.cpufreq.max = null; powerManagement.cpufreq.min = null; </del> <ins> environment.etc = { "tlp.conf".text = cfg.extraConfig; } // optionalAttrs enableRDW { "NetworkManager/dispatcher.d/99tlp-rdw-nm".source = "${tlp}/etc/NetworkManager/dispatcher.d/99tlp-rdw-nm"; }; </ins> <del> systemd.sockets.systemd-rfkill.enable = false; </del> <ins> environment.systemPackages = [ tlp ]; </ins> <del> systemd.services = { "systemd-rfkill@".enable = false; systemd-rfkill.enable = false; </del> <ins> # FIXME: When the config is parametrized we need to move these into a # conditional on the relevant options being enabled. powerManagement = { scsiLinkPolicy = null; cpuFreqGovernor = null; cpufreq.max = null; cpufreq.min = null; }; </ins> <del> tlp = { description = "TLP system startup/shutdown"; </del> <ins> services.udev.packages = [ tlp ]; </ins> <del> after = [ "multi-user.target" ]; </del> <ins> systemd = { packages = [ tlp ]; # XXX: These must always be disabled/masked according to [1]. # # [1]: https://github.com/linrunner/TLP/blob/a9ada09e0821f275ce5f93dc80a4d81a7ff62ae4/tlp-stat.in#L319 sockets.systemd-rfkill.enable = false; services.systemd-rfkill.enable = false; services.tlp = { # XXX: The service should reload whenever the configuration changes, # otherwise newly set power options remain inactive until reboot (or # manual unit restart.) restartTriggers = [ config.environment.etc."tlp.conf".source ]; # XXX: When using systemd.packages (which we do above) the [Install] # section of systemd units does not work (citation needed) so we manually # enforce it here. </ins> wantedBy = [ "multi-user.target" ]; <del> before = [ "shutdown.target" ]; restartTriggers = [ confFile ]; serviceConfig = { Type = "oneshot"; RemainAfterExit = true; ExecStart = "${tlp}/bin/tlp init start"; ExecStop = "${tlp}/bin/tlp init stop"; }; </del> }; <del> tlp-sleep = { description = "TLP suspend/resume"; wantedBy = [ "sleep.target" ]; </del> <ins> services.tlp-sleep = { # XXX: When using systemd.packages (which we do above) the [Install] # section of systemd units does not work (citation needed) so we manually # enforce it here. </ins> before = [ "sleep.target" ]; <del> unitConfig = { StopWhenUnneeded = true; }; serviceConfig = { Type = "oneshot"; RemainAfterExit = true; ExecStart = "${tlp}/bin/tlp suspend"; ExecStop = "${tlp}/bin/tlp resume"; }; </del> <ins> wantedBy = [ "sleep.target" ]; # XXX: `tlp suspend` requires /var/lib/tlp to exist in order to save # some stuff in there. There is no way, that I know of, to do this in # the package itself, so we do it here instead making sure the unit # won't fail due to the save dir not existing. serviceConfig.StateDirectory = "tlp"; </ins> }; }; <del> services.udev.packages = [ tlp ]; environment.etc = { "default/tlp".source = confFile; } // optionalAttrs enableRDW { "NetworkManager/dispatcher.d/99tlp-rdw-nm" = { source = "${tlp}/etc/NetworkManager/dispatcher.d/99tlp-rdw-nm"; }; }; environment.systemPackages = [ tlp ]; boot.kernelModules = [ "msr" ]; </del> }; }

Discussion:
Describe the bug Our current version of tlp, 1.2.1, is ancient and misses the large number of fixes in versions 1.3.0 and 1.3.1. A bump is warranted, but is nontrivial since a lot has changed. Additional context Maintainer information:
cc.
I'm working on this