all repos — nixfiles @ 6313b6121db30198fde62b0697ad31208fa37f3b

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
16
17
18
19
{
  config,
  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
    '';
  };
}