all repos — nixfiles @ f3f8d88d917b29d2c354c4fd06ba85e6d40ff833

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

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
    '';
  };
}