This commit is contained in:
2026-03-25 18:57:06 +00:00
parent fbf8265a08
commit 9bdcd24b29
3 changed files with 35 additions and 3 deletions
@@ -0,0 +1,33 @@
{ den, modules, ... }:
{
modules.rfkill-sleep = {
nixos =
{ pkgs, ... }:
let
sleep-rfkill = pkgs.writeShellScript "sleep-rfkill" "
${pkgs.util-linux}/bin/rfkill block all
";
wake-rfkill = pkgs.writeShellScript "wake-rfkill" "
${pkgs.util-linux}/bin/rfkill unblock all
";
in
{
# My laptop doesn't like having connectivity when it goes to sleep, it burns through battery
systemd.services.sleep-rfkill = {
enable = true;
DefaultDependencies = false;
StopWhenUnneeded = true;
description = "";
before = [ "sleep.target" ];
serviceConfig = {
Type = "oneshot";
ExecStart = "${sleep-rfkill}";
ExecStop = "${wake-rfkill}";
RemainAfterExit = true;
};
wantedBy = [ "sleep.target" ];
};
};
};
}