diff options
Diffstat (limited to 'machines/profpatsch/katara.nix')
-rw-r--r-- | machines/profpatsch/katara.nix | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/machines/profpatsch/katara.nix b/machines/profpatsch/katara.nix index 4b1cf4e3..9a1fe88d 100644 --- a/machines/profpatsch/katara.nix +++ b/machines/profpatsch/katara.nix @@ -372,6 +372,7 @@ in { timers.unlock-password-store = { description = "unlock password store on system start"; wantedBy = [ "timers.target" ]; + # run ~five seconds after user logs in timerConfig.OnStartupSec = "5s"; }; }) @@ -424,29 +425,43 @@ in { services.pyrnotify-ssh-connection = { description = "ssh connection to make pyrnotify work"; serviceConfig = { + # TODO: get out of the gpg-agent service directly Environment = ''"SSH_AUTH_SOCK=%t/gnupg/S.gpg-agent.ssh"''; - # forwards the remote socket over ssh, restarts every 5 minutes ExecStart = pkgs.writeScript "pyrnotify-start-ssh" '' #!${pkgs.stdenv.shell} + set -e + # first delete the socket file if it exists + # otherwise the forward doesn’t work ${lib.getBin pkgs.openssh}/bin/ssh \ bigmac \ "rm /home/bigmac/.weechat/pyrnotify.socket" + # forwards the remote socket over ssh + # thE options make it disconnect after 45 sec + # by sending a keepalive packet every 15 seconds + # and retrying 3 times ${lib.getBin pkgs.openssh}/bin/ssh \ + -o ServerAliveInterval=15 \ + -o ServerAliveCountMax=3 \ + -o ExitOnForwardFailure=yes \ -R /home/bigmac/.weechat/pyrnotify.socket:localhost:8099 \ - bigmac \ - "sleep 300" + -N \ + bigmac ''; - Restart = "on-failure"; }; + requires = [ "gpg-agent.service" ]; + after = [ "gpg-agent.service" ]; }; services.pyrnotify-listen = rec { description = "get notified about weechat messages"; serviceConfig = { ExecStart = "${lib.getBin pkgs.python }/bin/python ${myPkgs.pyrnotify} 8099"; + Restart = "on-failure"; + RestartSec = "5s"; }; - requires = [ "pyrnotify-ssh-connection.service" ]; - after = requires; + bindsTo = [ "pyrnotify-ssh-connection.service" ]; + after = [ "pyrnotify-ssh-connection.service" ]; + wantedBy = [ "default.target" ]; }; }) |