2020-09-05 14:37:49 +02:00
|
|
|
{ pkgs, lib, ... }: {
|
|
|
|
|
2021-11-01 09:20:42 +01:00
|
|
|
environment.systemPackages =
|
|
|
|
let
|
|
|
|
createScript = command: host: repository:
|
|
|
|
pkgs.writers.writeBashBin
|
|
|
|
"borg-${command}-on-${host}-for-${repository}" ''
|
|
|
|
${pkgs.borgbackup}/bin/borg \
|
|
|
|
${command} \
|
|
|
|
--rsh='ssh -i ~/.ssh/card_rsa.pub' borg@${host}.private:${repository}/. \
|
|
|
|
"$@"
|
|
|
|
'';
|
2022-01-13 13:40:18 +01:00
|
|
|
hosts = [ "pepe" "robi" ];
|
|
|
|
repositories = [ "pepe" "sterni" "robi" ];
|
2021-11-01 09:20:42 +01:00
|
|
|
commands = [ "list" ];
|
|
|
|
in
|
|
|
|
lib.flatten (map
|
|
|
|
(command:
|
|
|
|
map
|
|
|
|
(host: map (repository: createScript command host repository) repositories)
|
|
|
|
hosts)
|
|
|
|
commands);
|
2020-09-05 14:37:49 +02:00
|
|
|
|
|
|
|
}
|