diff options
| -rw-r--r-- | hel.nix | 23 |
1 files changed, 23 insertions, 0 deletions
| @@ -474,5 +474,28 @@ | |||
| 474 | systemd.user.services."pulseaudio".enable = lib.mkForce false; | 474 | systemd.user.services."pulseaudio".enable = lib.mkForce false; |
| 475 | systemd.user.services."ssh-agent".enable = lib.mkForce false; | 475 | systemd.user.services."ssh-agent".enable = lib.mkForce false; |
| 476 | systemd.user.sockets."pulseaudio".enable = lib.mkForce false; | 476 | systemd.user.sockets."pulseaudio".enable = lib.mkForce false; |
| 477 | |||
| 478 | systemd.services."prevent-suspend" = { | ||
| 479 | description = "Inhibit handling of lid-switch and sleep"; | ||
| 480 | |||
| 481 | path = with pkgs; | ||
| 482 | [ systemd coreutils ]; | ||
| 483 | |||
| 484 | script = '' | ||
| 485 | #!{pkgs.stdenv.shell} | ||
| 486 | |||
| 487 | exec systemd-inhibit --what=handle-lid-switch:sleep --why="prevent-suspend.service" --mode=block sleep infinity | ||
| 488 | ''; | ||
| 489 | |||
| 490 | serviceConfig = { | ||
| 491 | Type = "simple"; | ||
| 492 | }; | ||
| 493 | }; | ||
| 494 | |||
| 495 | services.udev.path = with pkgs; [ systemd ]; | ||
| 496 | services.udev.extraRules = '' | ||
| 497 | SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_ONLINE}=="0", RUN+="systemctl --no-block start prevent-suspend.service" | ||
| 498 | SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_ONLINE}=="1", RUN+="systemctl --no-block stop prevent-suspend.service" | ||
| 499 | ''; | ||
| 477 | } | 500 | } |
| 478 | 501 | ||
