From 0fa5c3bc685584cbdc6e3707e0638208119467c4 Mon Sep 17 00:00:00 2001 From: Ari Sosnovsky Date: Sun, 19 Jul 2026 09:25:55 -0400 Subject: [PATCH] ssh libnotify forward --- modules/nixos/common/ssh-notify.nix | 30 +++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/modules/nixos/common/ssh-notify.nix b/modules/nixos/common/ssh-notify.nix index c96ee31..31f57d8 100644 --- a/modules/nixos/common/ssh-notify.nix +++ b/modules/nixos/common/ssh-notify.nix @@ -71,20 +71,22 @@ in after = [ "default.target" ]; wantedBy = [ "default.target" ]; serviceConfig = { - ExecStart = let - listenerScript = pkgs.writeShellScript "ssh-notify-listener" '' - set -euo pipefail - # Remove stale socket if present - rm -f ${socketPath} - # Listen and for each connection read two lines (title line, body line) - # and invoke the real notify-send. We keep it running via systemd Restart. - while true; do - ${pkgs.socat}/bin/socat \ - UNIX-LISTEN:${socketPath},fork,mode=0666 \ - SYSTEM:'read title; read body; ${realNotifySend} "$title" "$body" || true' - done - ''; - in "${listenerScript}"; + ExecStart = + let + listenerScript = pkgs.writeShellScript "ssh-notify-listener" '' + set -euo pipefail + # Remove stale socket if present + rm -f ${socketPath} + # Listen and for each connection read two lines (title line, body line) + # and invoke the real notify-send. We keep it running via systemd Restart. + while true; do + ${pkgs.socat}/bin/socat \ + UNIX-LISTEN:${socketPath},fork,mode=0666 \ + SYSTEM:'read title; read body; ${realNotifySend} "$title" "$body" || true' + done + ''; + in + "${listenerScript}"; Restart = "always"; RestartSec = 2; };