From 489d3924307171751b174d62f64ce29a5c2550cf Mon Sep 17 00:00:00 2001 From: makefu Date: Sun, 21 Oct 2018 23:04:27 +0200 Subject: ma backup: init --- makefu/2configs/backup/state.nix | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 makefu/2configs/backup/state.nix (limited to 'makefu/2configs/backup/state.nix') diff --git a/makefu/2configs/backup/state.nix b/makefu/2configs/backup/state.nix new file mode 100644 index 00000000..1143708b --- /dev/null +++ b/makefu/2configs/backup/state.nix @@ -0,0 +1,25 @@ +{ config, ... }: +# back up all state +let + sec = toString ; + sshkey = sec + "/borg.priv"; + phrase = sec + "/borg.pw"; +in +{ + services.borgbackup.jobs.state = { + repo = "borg-${config.krebs.build.host.name}@backup.makefu.r:."; + paths = config.state; + encryption = { + mode = "repokey"; + passCommand = "cat ${phrase}"; + }; + environment.BORG_RSH = "ssh -i ${sshkey}"; + prune.keep = + { daily = 7; + weekly = 4; + monthly = -1; # Keep at least one archive for each month + }; + compression = "auto,lzma"; + startAt = "daily"; + }; +} -- cgit v1.2.3