summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2017-12-17 01:06:14 +0100
committerGregor Kleen <gkleen@yggdrasil.li>2017-12-17 01:06:14 +0100
commit0a2be7dd885f81749b195e438e0b9ae240fd937a (patch)
tree309a37f85d141d3f6542ec5c692b081d4d696093
parentcfc835ef40bc78235fe4719a8389a7ce8a7d1882 (diff)
downloadnixos-0a2be7dd885f81749b195e438e0b9ae240fd937a.tar
nixos-0a2be7dd885f81749b195e438e0b9ae240fd937a.tar.gz
nixos-0a2be7dd885f81749b195e438e0b9ae240fd937a.tar.bz2
nixos-0a2be7dd885f81749b195e438e0b9ae240fd937a.tar.xz
nixos-0a2be7dd885f81749b195e438e0b9ae240fd937a.zip
borg?
-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