system/settings/configuration/ssh-inhibit-idle.nix (view raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | { pkgs, ... }:
{
services.openssh.startWhenNeeded = true;
systemd.services."ssh-inhibit-idle@" = {
bindsTo = [ "sshd@%i.service" ];
wantedBy = [ "sshd@.service" ];
serviceConfig.ExecStart = ''
${pkgs.systemd}/bin/systemd-inhibit \
--mode block --what idle \
--who 'ssh session '%I \
--why 'session still active' \
${pkgs.coreutils}/bin/sleep infinity
'';
};
}
|