looks fine
This commit is contained in:
parent
f92e1ec78b
commit
bfbad5285e
1 changed files with 38 additions and 21 deletions
|
@ -8,10 +8,10 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
config = let
|
||||||
|
servers = ["porani" "workhorse" "workout"];
|
||||||
|
dirs = config.backup.all.restic.dirs;
|
||||||
|
|
||||||
backup.services.restic =
|
|
||||||
let
|
|
||||||
setup = server: {
|
setup = server: {
|
||||||
passwordFile = toString <secrets/backup/restic-repo>;
|
passwordFile = toString <secrets/backup/restic-repo>;
|
||||||
repo = "sftp::backup/remote-${config.networking.hostName}";
|
repo = "sftp::backup/remote-${config.networking.hostName}";
|
||||||
|
@ -24,13 +24,30 @@
|
||||||
OnCalendar = "daily";
|
OnCalendar = "daily";
|
||||||
Persistent = "true";
|
Persistent = "true";
|
||||||
};
|
};
|
||||||
dirs = config.backup.all.restic.dirs;
|
dirs = dirs;
|
||||||
};
|
};
|
||||||
in
|
|
||||||
{
|
hostname = config.networking.hostName;
|
||||||
"on-porani" = setup "porani.private";
|
infoEntry = server: {
|
||||||
"on-workhorse" = setup "workhorse.private";
|
restic = {
|
||||||
"on-workout" = setup "workout.private";
|
folders = dirs;
|
||||||
|
from = hostname;
|
||||||
|
to = server;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
in {
|
||||||
|
|
||||||
|
backup.services.restic = lib.zipAttrsWith
|
||||||
|
(name: vals: lib.head vals)
|
||||||
|
(map (server: {
|
||||||
|
"on-${server}" = setup "${server}.private";
|
||||||
|
}) servers);
|
||||||
|
|
||||||
|
environment.etc."info/restic-${hostname}.json" = {
|
||||||
|
enable = true;
|
||||||
|
text = builtins.toJSON (map infoEntry servers);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue