summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/backup/state.nix
diff options
context:
space:
mode:
authorlassulus <lass@blue.r>2018-11-10 19:42:46 +0100
committerlassulus <lass@blue.r>2018-11-10 19:42:46 +0100
commiteff97662c02f385b1740929639817fc5b8318f07 (patch)
treef11710101eed0dcc8d75304939f06e819339d9f0 /makefu/2configs/backup/state.nix
parent0028e3dde3dcb8e5e9394f7d230c7224b6177b79 (diff)
parent254e9e62b95951cecadd2b4800c03ef96f95b3c0 (diff)
Merge remote-tracking branch 'nextgum/master'
Diffstat (limited to 'makefu/2configs/backup/state.nix')
-rw-r--r--makefu/2configs/backup/state.nix25
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";
+ };
+}