restic: fix evaluation error in rcloneOptions

`lib.add` only works on integers.
This commit is contained in:
Jess 2026-01-19 14:47:39 +13:00 committed by Austin Horstman
parent b9ded38afa
commit 83eeebd967
3 changed files with 12 additions and 2 deletions

View file

@ -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);

View file

@ -91,6 +91,11 @@ in
;
initialize = true;
repository = "rclone:local:/root/restic-rclone-backup";
rcloneOptions = {
checksum = true;
color = "ALWAYS";
list-cutoff = 5;
};
};
prune = {

View file

@ -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"