fix backup arguments
This commit is contained in:
parent
a302112120
commit
1166d2038e
1 changed files with 35 additions and 26 deletions
61
flake.nix
61
flake.nix
|
@ -159,6 +159,7 @@
|
||||||
};
|
};
|
||||||
paths = lib.options.mkOption {
|
paths = lib.options.mkOption {
|
||||||
type = lib.types.listOf lib.types.str;
|
type = lib.types.listOf lib.types.str;
|
||||||
|
default = [ ];
|
||||||
};
|
};
|
||||||
preCommand = lib.options.mkOption {
|
preCommand = lib.options.mkOption {
|
||||||
type = lib.types.lines;
|
type = lib.types.lines;
|
||||||
|
@ -267,32 +268,40 @@
|
||||||
'';
|
'';
|
||||||
}.${cfg.storage};
|
}.${cfg.storage};
|
||||||
|
|
||||||
backupCommands = lib.strings.concatStringsSep "\n" (
|
backupCommands = lib.strings.concatStringsSep "\n"
|
||||||
map
|
(
|
||||||
(
|
map
|
||||||
backup:
|
(
|
||||||
let
|
backup:
|
||||||
oneFileSystem =
|
let
|
||||||
if backup.oneFileSystem
|
oneFileSystem =
|
||||||
then
|
if backup.oneFileSystem
|
||||||
" --one-file-system"
|
then
|
||||||
else
|
[ "--one-file-system" ]
|
||||||
"";
|
else
|
||||||
excludes = lib.strings.concatMapStrings
|
[ ];
|
||||||
(
|
excludes = map
|
||||||
arg: '' --exclude="${arg}"''
|
(
|
||||||
)
|
exclude: ''--exclude="${exclude}"''
|
||||||
backup.excludes;
|
)
|
||||||
paths = lib.strings.concatStringsSep " " backup.paths;
|
backup.excludes;
|
||||||
in
|
paths = map
|
||||||
''
|
(
|
||||||
${backup.preCommand}
|
path: ''"${path}"''
|
||||||
${package}/bin/restic backup${oneFileSystem}${excludes} ${paths}
|
)
|
||||||
${backup.postCommand}
|
backup.paths;
|
||||||
''
|
arguments = lib.strings.concatStringsSep " " (
|
||||||
)
|
oneFileSystem ++ excludes ++ paths
|
||||||
cfg.backups
|
);
|
||||||
);
|
in
|
||||||
|
''
|
||||||
|
${backup.preCommand}
|
||||||
|
${package}/bin/restic backup ${arguments}
|
||||||
|
${backup.postCommand}
|
||||||
|
''
|
||||||
|
)
|
||||||
|
cfg.backups
|
||||||
|
);
|
||||||
initCheck = {
|
initCheck = {
|
||||||
"b2" = ''
|
"b2" = ''
|
||||||
export RCLONE_CONFIG=/dev/null
|
export RCLONE_CONFIG=/dev/null
|
||||||
|
|
Loading…
Reference in a new issue