summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hel.nix28
1 files changed, 28 insertions, 0 deletions
diff --git a/hel.nix b/hel.nix
index 8e1462d9..928c4777 100644
--- a/hel.nix
+++ b/hel.nix
@@ -518,5 +518,33 @@
518 systemd.services."NetworkManager-wait-online".enable = true; 518 systemd.services."NetworkManager-wait-online".enable = true;
519 519
520 services.btrfs-snapshots.enable = true; 520 services.btrfs-snapshots.enable = true;
521
522 systemd.services."backup-odin@" = {
523 enable = true;
524
525 BindsTo = [ "btrfs-snapshots@%i.service" ];
526 After = [ "btrfs-snapshots@%i.service" ];
527
528 path = with pkgs; [borgbackup];
529
530 script = ''
531 borg create \
532 --stats \
533 --list \
534 --filter 'AME' \
535 --exclude-caches \
536 --keep-exclude-tags \
537 --patterns-from .backup \
538 --one-file-system \
539 --compression auto,lzma \
540 --dry-run \
541 borg.odin:/srv/backup/borg::yggdrasil.midgard.hel.$1-{utcnow}
542 '';
543 scriptArgs = [ "%i" ];
544
545 serviceConfig = {
546 WorkingDirectory = "/mnt/snapshot-%i";
547 };
548 };
521} 549}
522 550