nixos/borgbackup: make extraArgs a shell variable

in line with the other extra*Args variables
This commit is contained in:
Robert Schütz 2018-05-24 10:25:52 +02:00 committed by Robin Gloster
parent d32e2e3063
commit 3c0daa19e2

View File

@ -35,26 +35,26 @@ let
${cfg.preHook} ${cfg.preHook}
'' + optionalString cfg.doInit '' '' + optionalString cfg.doInit ''
# Run borg init if the repo doesn't exist yet # Run borg init if the repo doesn't exist yet
if ! borg list ${cfg.extraArgs} > /dev/null; then if ! borg list $extraArgs > /dev/null; then
borg init ${cfg.extraArgs} \ borg init $extraArgs \
--encryption ${cfg.encryption.mode} \ --encryption ${cfg.encryption.mode} \
$extraInitArgs $extraInitArgs
${cfg.postInit} ${cfg.postInit}
fi fi
'' + '' '' + ''
borg create ${cfg.extraArgs} \ borg create $extraArgs \
--compression ${cfg.compression} \ --compression ${cfg.compression} \
--exclude-from ${mkExcludeFile cfg} \ --exclude-from ${mkExcludeFile cfg} \
$extraCreateArgs \ $extraCreateArgs \
"::$archiveName$archiveSuffix" \ "::$archiveName$archiveSuffix" \
${escapeShellArgs cfg.paths} ${escapeShellArgs cfg.paths}
'' + optionalString cfg.appendFailedSuffix '' '' + optionalString cfg.appendFailedSuffix ''
borg rename ${cfg.extraArgs} \ borg rename $extraArgs \
"::$archiveName$archiveSuffix" "$archiveName" "::$archiveName$archiveSuffix" "$archiveName"
'' + '' '' + ''
${cfg.postCreate} ${cfg.postCreate}
'' + optionalString (cfg.prune.keep != { }) '' '' + optionalString (cfg.prune.keep != { }) ''
borg prune ${cfg.extraArgs} \ borg prune $extraArgs \
${mkKeepArgs cfg} \ ${mkKeepArgs cfg} \
--prefix ${escapeShellArg cfg.prune.prefix} \ --prefix ${escapeShellArg cfg.prune.prefix} \
$extraPruneArgs $extraPruneArgs
@ -93,7 +93,7 @@ let
}; };
environment = { environment = {
BORG_REPO = cfg.repo; BORG_REPO = cfg.repo;
inherit (cfg) extraInitArgs extraCreateArgs extraPruneArgs; inherit (cfg) extraArgs extraInitArgs extraCreateArgs extraPruneArgs;
} // (mkPassEnv cfg) // cfg.environment; } // (mkPassEnv cfg) // cfg.environment;
inherit (cfg) startAt; inherit (cfg) startAt;
}; };
@ -463,7 +463,7 @@ in {
service has. Handle with care. service has. Handle with care.
''; '';
default = ""; default = "";
example = "--remote-path=borg1"; example = "--remote-path=/path/to/borg";
}; };
extraInitArgs = mkOption { extraInitArgs = mkOption {