nixos/borgbackup: add extraArgs to wrapper script

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
DoctorDalek1963
2025-06-09 11:25:35 +01:00
committed by Sefa Eyeoglu
parent 6c1a443d51
commit 719d6217ff
2 changed files with 9 additions and 3 deletions

View File

@@ -206,16 +206,17 @@ let
original,
name,
set ? { },
extraArgs ? null,
}:
pkgs.runCommand "${name}-wrapper"
{
nativeBuildInputs = [ pkgs.makeWrapper ];
}
''
makeWrapper "${original}" "$out/bin/${name}" \
${lib.concatStringsSep " \\\n " (
lib.mapAttrsToList (name: value: ''--set ${name} "${value}"'') set
(lib.mapAttrsToList (name: value: ''--set ${name} "${value}"'') set)
++ (lib.optional (extraArgs != null) ''--add-flags "${extraArgs}"'')
)}
'';
@@ -230,6 +231,7 @@ let
}
// (mkPassEnv cfg)
// cfg.environment;
extraArgs = cfg.extraArgs or null;
});
# Paths listed in ReadWritePaths must exist before service is started
@@ -778,6 +780,9 @@ in
description = ''
Additional arguments for all {command}`borg` calls the
service has. Handle with care.
These extra arguments also get included in the wrapper
script for this job.
'';
default = [ ];
example = [ "--remote-path=/path/to/borg" ];

View File

@@ -131,7 +131,8 @@ in
repo = remoteRepo;
encryption.mode = "none";
startAt = [ ];
environment.BORG_RSH = "ssh -oStrictHostKeyChecking=no -i /root/id_ed25519";
# This uses extraArgs instead of BORG_RSH to test propagation of these args
extraArgs = [ "--rsh=ssh -oStrictHostKeyChecking=no -i /root/id_ed25519" ];
};
commandFail = {