1
0
forked from clan/clan-core

fix case when we have multiple backup destinations

This commit is contained in:
Jörg Thalheim 2024-03-19 18:57:14 +01:00 committed by Mic92
parent 9383e41d68
commit 5f9d3b514b

View File

@ -90,17 +90,19 @@ in
'';
};
environment.systemPackages = [ pkgs.jq ];
clanCore.backups.providers.borgbackup = {
# TODO list needs to run locally or on the remote machine
list = ''
set -efu
# we need yes here to skip the changed url verification
${lib.concatMapStringsSep "\n" (
dest: ''
yes y | borg-job-${dest.name} list --json | jq '{"backups": [.archives[] | {"name": ("${dest.repo}::" + .name), "job_name": "${dest.name}"}]}'
''
) (lib.attrValues cfg.destinations)}
${
lib.concatMapStringsSep "\\\n" (
dest:
''yes y | borg-job-${dest.name} list --json | jq '[.archives[] | {"name": ("${dest.repo}::" + .name), "job_name": "${dest.name}"}]' ''
) (lib.attrValues cfg.destinations)
} | jq -s 'add'
'';
create = ''
${lib.concatMapStringsSep "\n" (dest: ''