fix backup arguments
This commit is contained in:
parent
a302112120
commit
1166d2038e
1 changed files with 35 additions and 26 deletions
23
flake.nix
23
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,7 +268,8 @@
|
||||||
'';
|
'';
|
||||||
}.${cfg.storage};
|
}.${cfg.storage};
|
||||||
|
|
||||||
backupCommands = lib.strings.concatStringsSep "\n" (
|
backupCommands = lib.strings.concatStringsSep "\n"
|
||||||
|
(
|
||||||
map
|
map
|
||||||
(
|
(
|
||||||
backup:
|
backup:
|
||||||
|
@ -275,19 +277,26 @@
|
||||||
oneFileSystem =
|
oneFileSystem =
|
||||||
if backup.oneFileSystem
|
if backup.oneFileSystem
|
||||||
then
|
then
|
||||||
" --one-file-system"
|
[ "--one-file-system" ]
|
||||||
else
|
else
|
||||||
"";
|
[ ];
|
||||||
excludes = lib.strings.concatMapStrings
|
excludes = map
|
||||||
(
|
(
|
||||||
arg: '' --exclude="${arg}"''
|
exclude: ''--exclude="${exclude}"''
|
||||||
)
|
)
|
||||||
backup.excludes;
|
backup.excludes;
|
||||||
paths = lib.strings.concatStringsSep " " backup.paths;
|
paths = map
|
||||||
|
(
|
||||||
|
path: ''"${path}"''
|
||||||
|
)
|
||||||
|
backup.paths;
|
||||||
|
arguments = lib.strings.concatStringsSep " " (
|
||||||
|
oneFileSystem ++ excludes ++ paths
|
||||||
|
);
|
||||||
in
|
in
|
||||||
''
|
''
|
||||||
${backup.preCommand}
|
${backup.preCommand}
|
||||||
${package}/bin/restic backup${oneFileSystem}${excludes} ${paths}
|
${package}/bin/restic backup ${arguments}
|
||||||
${backup.postCommand}
|
${backup.postCommand}
|
||||||
''
|
''
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue