From 5f9d3b514ba0fd147de166c29ad29fffe4bf527a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Tue, 19 Mar 2024 18:57:14 +0100 Subject: [PATCH] fix case when we have multiple backup destinations --- clanModules/borgbackup.nix | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/clanModules/borgbackup.nix b/clanModules/borgbackup.nix index 419e8dc0..b3979da1 100644 --- a/clanModules/borgbackup.nix +++ b/clanModules/borgbackup.nix @@ -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: ''