summaryrefslogtreecommitdiffstats
path: root/makefu/4lib/default.nix
blob: 5e9ab20873a70f069fbc11c732df3d2e59eb405c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
{ config, lib, ... }:

with lib;
let
  addDefaultTime = bku-entry: recursiveUpdate {
    snapshots = {
      daily    = { format = "%Y-%m-%d"; retain =  7; };
      weekly   = { format = "%YW%W";    retain =  4; };
      monthly  = { format = "%Y-%m";    retain = 12; };
      yearly   = { format = "%Y";                    };
    };
    startAt = "5:23";
  } bku-entry;

  backup-host = config.krebs.hosts.omo;
  backup-path = "/media/backup";
in {
  bku = {
    inherit addDefaultTime;
    simplePath = addDefaultTime (path: {
      method = "pull";
      src = { host = config.krebs.build.host; inherit path; };
      dst = {
        host = backup-host;
        path = backup-path ++ config.krebs.build.host.name
                           ++ builtins.replaceStrings ["/"] ["-"] path;
      };
    });
  };
}