restic: fix evaluation error in rcloneOptions
`lib.add` only works on integers.
This commit is contained in:
parent
b9ded38afa
commit
83eeebd967
3 changed files with 12 additions and 2 deletions
|
|
@ -24,10 +24,11 @@ let
|
|||
lib.pipe opt [
|
||||
(lib.replaceStrings [ "-" ] [ "_" ])
|
||||
lib.toUpper
|
||||
(lib.add "RCLONE_")
|
||||
(upper: "RCLONE_" + upper)
|
||||
];
|
||||
|
||||
toEnvVal = v: if lib.isBool v then lib.boolToString v else v;
|
||||
toEnvVal = v: if lib.isBool v then lib.boolToString v else toString v;
|
||||
|
||||
attrsToEnvs =
|
||||
attrs:
|
||||
lib.pipe attrs [
|
||||
|
|
@ -127,6 +128,7 @@ in
|
|||
attrsOf (oneOf [
|
||||
str
|
||||
bool
|
||||
int
|
||||
]);
|
||||
default = { };
|
||||
apply = lib.mapAttrs' (opt: v: lib.nameValuePair (fmtRcloneOpt opt) v);
|
||||
|
|
|
|||
|
|
@ -91,6 +91,11 @@ in
|
|||
;
|
||||
initialize = true;
|
||||
repository = "rclone:local:/root/restic-rclone-backup";
|
||||
rcloneOptions = {
|
||||
checksum = true;
|
||||
color = "ALWAYS";
|
||||
list-cutoff = 5;
|
||||
};
|
||||
};
|
||||
|
||||
prune = {
|
||||
|
|
|
|||
|
|
@ -106,6 +106,9 @@ in
|
|||
serviceFile=$serviceFiles/restic-backups-"$backup".service
|
||||
assertFileRegex $serviceFile "Environment=RESTIC_REPOSITORY=rclone:local:/root/restic-rclone-backup"
|
||||
assertFileRegex $serviceFile "Environment=RESTIC_PASSWORD_FILE"
|
||||
assertFileRegex $serviceFile "Environment=RCLONE_CHECKSUM=true"
|
||||
assertFileRegex $serviceFile "Environment=RCLONE_COLOR=ALWAYS"
|
||||
assertFileRegex $serviceFile "Environment=RCLONE_LIST_CUTOFF=5"
|
||||
assertFileRegex $serviceFile "ExecStart=.*$defaultPruneOpts"
|
||||
for part in ''${defaultPruneOpts[@]}; do
|
||||
assertFileRegex $serviceFile "ExecStart=.*$part"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue