laptop(battery): rfkills the wifi and bluetooth apon sleep

This commit is contained in:
2026-01-03 11:59:22 +00:00
parent 8a3c5e155a
commit 017fc7105e
2 changed files with 31 additions and 5 deletions

View File

@@ -32,9 +32,14 @@ in
services.upower = {
enable = true;
};
# boot.kernelParams = [ "mem_sleep_default=deep" ];
boot.kernelParams = [
# "mem_sleep_default=deep"
"i915.fastboot=1"
"pcie_aspm=force"
"ahci.mobile_lpm_policy=1"
];
services.logind.settings.Login = {
HandleLidSwitch = "hibernate";
HandleLidSwitch = "suspend";
HandleLidSwitchExternalPower = "suspend";
HandleLidSwitchDocked = "ignore";
};
@@ -48,4 +53,25 @@ in
enable = true;
# powertop.enable = true;
};
systemd.user.services.rfkill-sleep = {
# I haven't tested this, but in theory, disabling rf devices before sleep will save on power
enable = true;
before = [ "systemd-suspend.service" ];
wantedBy = [ "default.target" ];
description = "Using rfkill; disables all rf devices before sleeping. useful for saving power";
serviceConfig = {
Type = "simple";
ExecStart = ''${pkgs.utillinux}/bin/rfkill block all'';
};
};
systemd.user.services.rfkill-wake = {
enable = true;
after = [ "systemd-suspend.service" ];
wantedBy = [ "default.target" ];
description = "Using rfkill; enable all rf devices after sleeping.";
serviceConfig = {
Type = "simple";
ExecStart = ''${pkgs.utillinux}/bin/rfkill unblock all'';
};
};
}