laptop: check for tuned service before enabling tlp

This commit is contained in:
Joaquín Triñanes 2025-10-05 17:43:21 +02:00
parent 3441b5242a
commit 111d7c3baa
No known key found for this signature in database
GPG key ID: 6E1446DD451C6BAF
2 changed files with 16 additions and 6 deletions

View file

@ -1,4 +1,9 @@
{ config, lib, ... }: {
config,
lib,
options,
...
}:
{ {
imports = [ ../. ]; imports = [ ../. ];
@ -7,7 +12,7 @@
# However, these 2 services clash when enabled simultaneously. # However, these 2 services clash when enabled simultaneously.
# https://github.com/NixOS/nixos-hardware/issues/260 # https://github.com/NixOS/nixos-hardware/issues/260
services.tlp.enable = lib.mkDefault ( services.tlp.enable = lib.mkDefault (
(lib.versionOlder (lib.versions.majorMinor lib.version) "21.05") !(options.services ? power-profiles-daemon && config.services.power-profiles-daemon.enable)
|| !config.services.power-profiles-daemon.enable && !(options.services ? tuned && config.services.tuned.enable)
); );
} }

View file

@ -1,4 +1,9 @@
{ config, lib, ... }: {
config,
lib,
options,
...
}:
{ {
imports = [ imports = [
../../common/cpu/intel ../../common/cpu/intel
@ -11,8 +16,8 @@
]; ];
services.tlp.enable = lib.mkDefault ( services.tlp.enable = lib.mkDefault (
(lib.versionOlder (lib.versions.majorMinor lib.version) "21.05") !(options.services ? power-profiles-daemon && config.services.power-profiles-daemon.enable)
|| !config.services.power-profiles-daemon.enable && !(options.services ? tuned && config.services.tuned.enable)
); );
# Required for grub to properly display the boot menu. # Required for grub to properly display the boot menu.