all repos — nixfiles @ 98db86c5351406f6c173aa965a0d0bb25973ae3c

System and user configuration, managed by nix and home-manager

prefect: disable sleep whilst ssh server sessions active
Alan Pearce alan@alanpearce.eu
Sun, 23 Apr 2023 21:48:36 +0200
commit

98db86c5351406f6c173aa965a0d0bb25973ae3c

parent

162d59aea1c7690c0fceaeaeddb7cc885b719c1b

1 files changed, 5 insertions(+), 0 deletions(-)

jump to
M system/prefect.nixsystem/prefect.nix
@@ -123,6 +123,11 @@ enable = true;     openFirewall = false;
     startWhenNeeded = true;
   };
+  systemd.services."ssh-no-sleep@" = {
+    bindsTo = [ "sshd@%i.service" ];
+    wantedBy = [ "sshd@.service" ];
+    serviceConfig.ExecStart = "${pkgs.systemd}/bin/systemd-inhibit --mode block --what sleep --who 'ssh session '%I --why 'session still active' ${pkgs.coreutils}/bin/sleep infinity";
+  };
 
   networking.nftables = {
     enable = true;