ci-runner: shutdown on idle
1 file changed, 19 insertions(+), 0 deletions(-)
changed files
M system/roles/ci-runner.nix → system/roles/ci-runner.nix
@@ -4,6 +4,25 @@ pkgs, ... }: { + 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 = { }; users.users.laminar = { group = "laminar";