diff options
author | makefu <github@syntax-fehler.de> | 2018-10-21 23:04:27 +0200 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2018-10-21 23:04:27 +0200 |
commit | 489d3924307171751b174d62f64ce29a5c2550cf (patch) | |
tree | 6ece4bd4baa029dddefd8f496096f68fcee1b22f /makefu/2configs/backup/state.nix | |
parent | cea8403dc5eb48792c9ccd4c4fc9584a84ba4238 (diff) |
ma backup: init
Diffstat (limited to 'makefu/2configs/backup/state.nix')
-rw-r--r-- | makefu/2configs/backup/state.nix | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/makefu/2configs/backup/state.nix b/makefu/2configs/backup/state.nix new file mode 100644 index 000000000..1143708bf --- /dev/null +++ b/makefu/2configs/backup/state.nix @@ -0,0 +1,25 @@ +{ config, ... }: +# back up all state +let + sec = toString <secrets>; + 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"; + }; +} |