diff options
-rw-r--r-- | modules/rsync_backup/default.nix | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/modules/rsync_backup/default.nix b/modules/rsync_backup/default.nix index dadf5e7c..a2ef0fdc 100644 --- a/modules/rsync_backup/default.nix +++ b/modules/rsync_backup/default.nix | |||
@@ -84,19 +84,16 @@ let | |||
84 | 84 | ||
85 | ssh_key = config.secrets.fullPaths."rsync_backup/identity"; | 85 | ssh_key = config.secrets.fullPaths."rsync_backup/identity"; |
86 | 86 | ||
87 | backup_head = mailto: '' | 87 | backup_head = '' |
88 | #!${pkgs.stdenv.shell} | 88 | #!${pkgs.stdenv.shell} |
89 | EXCL_FROM=`mktemp` | 89 | EXCL_FROM=`mktemp` |
90 | FILES_FROM=`mktemp` | 90 | FILES_FROM=`mktemp` |
91 | TMP_STDERR=`mktemp` | 91 | TMP_STDERR=`mktemp` |
92 | 92 | ||
93 | on_exit() { | 93 | on_exit() { |
94 | ${lib.optionalString (mailto != null) '' | ||
95 | MAILTO="${mailto}" | ||
96 | if [ -s "$TMP_STDERR" ]; then | 94 | if [ -s "$TMP_STDERR" ]; then |
97 | cat "$TMP_STDERR" | ${pkgs.mailutils}/bin/mail -s "save_distant rsync error" "$MAILTO" | 95 | cat "$TMP_STDERR" |
98 | fi | 96 | fi |
99 | ''} | ||
100 | rm -f $TMP_STDERR $EXCL_FROM $FILES_FROM | 97 | rm -f $TMP_STDERR $EXCL_FROM $FILES_FROM |
101 | } | 98 | } |
102 | 99 | ||
@@ -186,11 +183,6 @@ in | |||
186 | type = lib.types.path; | 183 | type = lib.types.path; |
187 | description = "Path to the base folder for backups"; | 184 | description = "Path to the base folder for backups"; |
188 | }; | 185 | }; |
189 | mailto = lib.mkOption { | ||
190 | type = lib.types.nullOr lib.types.str; | ||
191 | default = null; | ||
192 | description = "E-mail to send the report to"; | ||
193 | }; | ||
194 | profiles = lib.mkOption { | 186 | profiles = lib.mkOption { |
195 | type = lib.types.attrsOf profileModule; | 187 | type = lib.types.attrsOf profileModule; |
196 | default = {}; | 188 | default = {}; |
@@ -223,7 +215,7 @@ in | |||
223 | 215 | ||
224 | services.cron.systemCronJobs = let | 216 | services.cron.systemCronJobs = let |
225 | backup = pkgs.writeScript "backup.sh" (builtins.concatStringsSep "\n" ([ | 217 | backup = pkgs.writeScript "backup.sh" (builtins.concatStringsSep "\n" ([ |
226 | (backup_head cfg.mailto) | 218 | backup_head |
227 | ] ++ lib.mapAttrsToList backup_profile cfg.profiles)); | 219 | ] ++ lib.mapAttrsToList backup_profile cfg.profiles)); |
228 | in [ | 220 | in [ |
229 | '' | 221 | '' |