extract ssh idle sleep/shutdown configuration
3 files changed, 24 insertions(+), 21 deletions(-)
M system/roles/ci-runner.nix → system/roles/ci-runner.nix
@@ -4,23 +4,14 @@ pkgs, ... }: { + imports = [ + ../settings/configuration/ssh-inhibit-idle.nix + ]; + services.logind.settings.Login = { IdleAction = "poweroff"; IdleActionSec = "1 hour"; StopIdleSessionSec = "15 min"; - }; - - 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 - ''; }; users.groups.laminar = { };
M system/roles/desktop.nix → system/roles/desktop.nix
@@ -1,15 +1,8 @@ -{ pkgs, ... }: { imports = [ ./base.nix + ../settings/configuration/ssh-inhibit-idle.nix ]; - - services.openssh.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"; - }; services.syncthing = { systemService = false;
A system/settings/configuration/ssh-inhibit-idle.nix
@@ -0,0 +1,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 + ''; + }; +}