Commit 8a51bf3aaf71

Vincent Demeester <vincent@sbr.pm>
2026-01-14 22:28:07
fix(mail): correct ntfy notification implementation
- Use curl instead of ntfy CLI command to match kerkouane pattern - Fix topic from infrastructure.sbr.pm to homelab - Add proper HTTP headers (Title, Priority, Tags) for better notifications - Update PATH to include curl instead of ntfy-sh Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent 1789e76
Changed files (1)
home
common
home/common/services/mail-monitor.nix
@@ -186,10 +186,13 @@ let
 
     # Send ntfy notification if token is available
     if TOKEN=$(${pkgs.passage}/bin/passage show ntfy/token 2>/dev/null); then
-      ${pkgs.ntfy-sh}/bin/ntfy publish \
-        --token "$TOKEN" \
-        infrastructure.sbr.pm \
-        "⚠️ Mail service $SERVICE_NAME failed" || true
+      ${pkgs.curl}/bin/curl -s \
+        -H "Authorization: Bearer $TOKEN" \
+        -H "Title: ⚠️ Mail Service Failed: $SERVICE_NAME" \
+        -H "Priority: high" \
+        -H "Tags: warning,mail,envelope" \
+        -d "Mail service $SERVICE_NAME failed. Check logs: journalctl --user -u $SERVICE_NAME" \
+        "https://ntfy.sbr.pm/homelab" || true
     fi
   '';
 in
@@ -214,7 +217,7 @@ in
     Service = {
       Type = "oneshot";
       Environment = [
-        "PATH=${pkgs.bash}/bin:${pkgs.coreutils}/bin:${pkgs.ntfy-sh}/bin:${pkgs.passage}/bin"
+        "PATH=${pkgs.bash}/bin:${pkgs.coreutils}/bin:${pkgs.curl}/bin:${pkgs.passage}/bin"
         "PASSAGE_DIR=/home/vincent/.local/share/passage"
         "PASSAGE_IDENTITIES_FILE=/home/vincent/.local/share/passage/identities"
       ];