From 9ae18245891ce0bc868584cd668c3ef38457d7f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torjus=20H=C3=A5kestad?= Date: Thu, 2 May 2024 12:43:30 +0200 Subject: [PATCH] Improve backup-home --- home/services/backup-home.nix | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/home/services/backup-home.nix b/home/services/backup-home.nix index 4808d89..aa495f2 100644 --- a/home/services/backup-home.nix +++ b/home/services/backup-home.nix @@ -14,10 +14,15 @@ let echo "========== BACKUP HOME STARTING ==========" export RESTIC_PASSWORD="gunter.home.2rjus.net" export RESTIC_REPOSITORY="rest:http://10.69.12.52:8000/gunter.home.2rjus.net" - GOTIFY_TOKEN=$(<"$XDG_CONFIG_HOME/sops-nix/secrets/gotify_backup_home") + SECRET_PATH="$XDG_CONFIG_HOME/sops-nix/secrets/gotify_backup_home" - if [ -z "$GOTIFY_TOKEN" ]; then - notify-send -u critical "Backup issue" "No Gotify token found" + if ! [ -f "$SECRET_PATH" ]; then + notify-send -u critical "Backup issue" "Secret file for gotify token does not exist" + else + GOTIFY_TOKEN=$(<"$SECRET_PATH") + if [ -z "$GOTIFY_TOKEN" ]; then + notify-send -u critical "Backup issue" "No Gotify token found" + fi fi # Send start notification @@ -85,7 +90,6 @@ let }; in { - sops.secrets."gotify_backup_home" = { }; systemd.user.services.backup-home = {