fix(tuned/laptop): auto profile swap

This commit is contained in:
2026-01-15 02:27:21 +00:00
parent 175fd9e2d4
commit 06f32a0d38

View File

@@ -65,13 +65,13 @@ let
[doloro-power-saver] [doloro-power-saver]
virt= virt=
system= system=
/sys/class/power_supply/AC/online=0 /sys/class/power_supply/BAT0/status=Discharging
# Profile for devices on AC power # Profile for devices on AC power
[doloro-balanced] [doloro-balanced]
virt= virt=
system= system=
/sys/class/power_supply/AC/online=1 /sys/class/power_supply/BAT0/status=Charging
[atomic-host] [atomic-host]
virt= virt=
@@ -148,52 +148,52 @@ in
# }; # };
services.tuned = { services.tuned = {
enable = true; enable = true;
autoProfile = true; profiles = {
extraProfiles = { doloro-power-saver = {
doloro-power-saving = { main = {
description = "Custom power-saving profile inheriting from powersave"; include = "powersave";
config = '' };
include=powersave script = {
script = "${battery-limit-script}/bin/set-battery-limit,${gpu-limit-frequency}/bin/set-gpu-limit";
[plugins] };
script=on
[script]
script=${battery-limit-script}/bin/set-battery-limit,${gpu-limit-frequency}/bin/set-gpu-limit
mode=start
'';
}; };
doloro-balanced = { doloro-balanced = {
description = "Custom balanced profile inheriting from balanced"; main = {
config = '' include = "balanced";
include=balanced };
script = {
[plugins] script = "${battery-limit-script}/bin/set-battery-limit";
script=on };
[script]
script=${battery-limit-script}/bin/set-battery-limit
mode=start
'';
}; };
}; };
}; };
environment.etc = { environment.etc = {
tuned.recommend.conf = { "tuned/recommend.conf" = {
text = tuned-auto-profile-config; text = tuned-auto-profile-config;
}; };
}; };
systemd.services.tuned-auto-profile = { systemd.services = {
description = "Enable Auto Profile in TuneD"; # Tells tuned "hey, re-eval system state and change profiles accordingly"
after = [ "network.target" ]; # Ensure network is up (if needed for TuneD) send-sighup-to-tuned = {
wantedBy = [ "multi-user.target" ]; # Start in the default target mode serviceConfig = {
ExecStart = "${pkgs.killall}/bin/killall -1 .tuned-wrapped";
Restart = "always";
RestartSec = "30s";
};
wantedBy = [ "multi-user.target" ];
};
tuned-auto-profile = {
description = "Enable Auto Profile in TuneD";
after = [ "network.target" ]; # Ensure network is up (if needed for TuneD)
wantedBy = [ "multi-user.target" ]; # Start in the default target mode
# Command to run # Command to run
serviceConfig = { serviceConfig = {
ExecStart = "${pkgs.tuned}/bin/tuned-adm auto_profile"; ExecStart = "${pkgs.tuned}/bin/tuned-adm auto_profile";
Restart = "on-failure"; Restart = "on-failure";
RestartSec = 5; # Wait 5 seconds before retrying if it fails RestartSec = 5; # Wait 5 seconds before retrying if it fails
Environment = "PATH=/sbin:/bin:/usr/sbin:/usr/bin"; # Ensure PATH is correct Environment = "PATH=/sbin:/bin:/usr/sbin:/usr/bin"; # Ensure PATH is correct
};
}; };
}; };
services.thermald.enable = true; services.thermald.enable = true;