all repos — nixfiles @ 9bb7736b1a18dc2742ea82eebc045b62bf6e2c4e

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