24 lines
694 B
Nix
24 lines
694 B
Nix
{ pkgs, lib, ... }: {
|
|
|
|
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}/. \
|
|
"$@"
|
|
'';
|
|
hosts = [ "workhorse" "pepe" ];
|
|
repositories = [ "workhorse" "pepe" "sterni" "workout" ];
|
|
commands = [ "list" ];
|
|
in
|
|
lib.flatten (map
|
|
(command:
|
|
map
|
|
(host: map (repository: createScript command host repository) repositories)
|
|
hosts)
|
|
commands);
|
|
|
|
}
|