From 0a2be7dd885f81749b195e438e0b9ae240fd937a Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sun, 17 Dec 2017 01:06:14 +0100 Subject: borg? --- hel.nix | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/hel.nix b/hel.nix index 8e1462d9..928c4777 100644 --- a/hel.nix +++ b/hel.nix @@ -518,5 +518,33 @@ systemd.services."NetworkManager-wait-online".enable = true; services.btrfs-snapshots.enable = true; + + systemd.services."backup-odin@" = { + enable = true; + + BindsTo = [ "btrfs-snapshots@%i.service" ]; + After = [ "btrfs-snapshots@%i.service" ]; + + path = with pkgs; [borgbackup]; + + script = '' + borg create \ + --stats \ + --list \ + --filter 'AME' \ + --exclude-caches \ + --keep-exclude-tags \ + --patterns-from .backup \ + --one-file-system \ + --compression auto,lzma \ + --dry-run \ + borg.odin:/srv/backup/borg::yggdrasil.midgard.hel.$1-{utcnow} + ''; + scriptArgs = [ "%i" ]; + + serviceConfig = { + WorkingDirectory = "/mnt/snapshot-%i"; + }; + }; } -- cgit v1.2.3