2020-09-05 14:37:49 +02:00
|
|
|
{ pkgs, lib, ... }: {
|
|
|
|
|
2021-11-01 09:20:42 +01:00
|
|
|
environment.systemPackages =
|
|
|
|
let
|
2023-03-07 16:21:46 +01:00
|
|
|
createScript = command: target: repository:
|
2021-11-01 09:20:42 +01:00
|
|
|
pkgs.writers.writeBashBin
|
2023-03-07 16:21:46 +01:00
|
|
|
"borg-${command}-on-${target}-for-${repository}" ''
|
2021-11-01 09:20:42 +01:00
|
|
|
${pkgs.borgbackup}/bin/borg \
|
|
|
|
${command} \
|
2023-03-07 16:21:46 +01:00
|
|
|
--rsh='ssh -i ~/.ssh/palo_rsa.pub' ${target}.private:${repository}/. \
|
2021-11-01 09:20:42 +01:00
|
|
|
"$@"
|
|
|
|
'';
|
2023-03-07 16:21:46 +01:00
|
|
|
targets = [ "borg@pepe" "borg@robi" "borg@cream" "removable@cream" ];
|
|
|
|
repositories = [ "pepe" "sterni" "robi" "cream" ];
|
2022-01-23 21:14:24 +01:00
|
|
|
commands = [ "list" "mount" ];
|
2021-11-01 09:20:42 +01:00
|
|
|
in
|
|
|
|
lib.flatten (map
|
|
|
|
(command:
|
|
|
|
map
|
2023-03-07 16:21:46 +01:00
|
|
|
(target: map (repository: createScript command target repository) repositories)
|
|
|
|
targets)
|
2021-11-01 09:20:42 +01:00
|
|
|
commands);
|
2020-09-05 14:37:49 +02:00
|
|
|
|
|
|
|
}
|