diff options
| -rw-r--r-- | hel.nix | 8 |
1 files changed, 4 insertions, 4 deletions
| @@ -475,7 +475,7 @@ | |||
| 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 | 477 | ||
| 478 | systemd.services."prevent-suspend" = { | 478 | systemd.services."ac-plugged" = { |
| 479 | description = "Inhibit handling of lid-switch and sleep"; | 479 | description = "Inhibit handling of lid-switch and sleep"; |
| 480 | 480 | ||
| 481 | path = with pkgs; | 481 | path = with pkgs; |
| @@ -484,7 +484,7 @@ | |||
| 484 | script = '' | 484 | script = '' |
| 485 | #!{pkgs.stdenv.shell} | 485 | #!{pkgs.stdenv.shell} |
| 486 | 486 | ||
| 487 | exec systemd-inhibit --what=handle-lid-switch:sleep --why="prevent-suspend.service" --mode=block sleep infinity | 487 | exec systemd-inhibit --what=handle-lid-switch:sleep --why="AC is connected" --mode=block sleep infinity |
| 488 | ''; | 488 | ''; |
| 489 | 489 | ||
| 490 | serviceConfig = { | 490 | serviceConfig = { |
| @@ -493,8 +493,8 @@ | |||
| 493 | }; | 493 | }; |
| 494 | 494 | ||
| 495 | services.udev.extraRules = with pkgs; '' | 495 | services.udev.extraRules = with pkgs; '' |
| 496 | SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_ONLINE}=="0", RUN+="${systemd}/bin/systemctl --no-block stop prevent-suspend.service" | 496 | SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_ONLINE}=="0", RUN+="${systemd}/bin/systemctl --no-block stop ac-plugged.service" |
| 497 | SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_ONLINE}=="1", RUN+="${systemd}/bin/systemctl --no-block start prevent-suspend.service" | 497 | SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_ONLINE}=="1", RUN+="${systemd}/bin/systemctl --no-block start ac-plugged.service" |
| 498 | ''; | 498 | ''; |
| 499 | } | 499 | } |
| 500 | 500 | ||
