diff --git a/modules/programs/rclone.nix b/modules/programs/rclone.nix index 3f1468bf0..c41d0caf7 100644 --- a/modules/programs/rclone.nix +++ b/modules/programs/rclone.nix @@ -140,35 +140,35 @@ let let label = "rclone-${cmdName}:${replaceIllegalChars sidecarPath}@${remoteName}"; runAtLoad = if isMount then sidecar.autoMount else sidecar.autoStart; - rcloneArgs = - [ - (lib.getExe cfg.package) - cmdName - ] - ++ (lib.cli.toCommandLineGNU { } sidecar.options) - ++ ( - if isMount then - [ - "${remoteName}:${sidecarPath}" - sidecar.mountPoint - ] - else - [ - sidecar.protocol - "${remoteName}:${sidecarPath}" - ] - ); + rcloneArgs = [ + (lib.getExe cfg.package) + cmdName + ] + ++ (lib.cli.toCommandLineGNU { } sidecar.options) + ++ ( + if isMount then + [ + "${remoteName}:${sidecarPath}" + sidecar.mountPoint + ] + else + [ + sidecar.protocol + "${remoteName}:${sidecarPath}" + ] + ); in { enable = true; config = { - ProgramArguments = - [ (lib.getExe rcloneSidecarWrapper) ] - ++ (lib.optionals isMount [ - "--mkdir" - sidecar.mountPoint - ]) - ++ rcloneArgs; + ProgramArguments = [ + (lib.getExe rcloneSidecarWrapper) + ] + ++ (lib.optionals isMount [ + "--mkdir" + sidecar.mountPoint + ]) + ++ rcloneArgs; RunAtLoad = runAtLoad; KeepAlive = { SuccessfulExit = false; @@ -201,18 +201,16 @@ let cmdName = if isMount then "mount" else "serve"; in lib.optional sidecar.enable ( - lib.nameValuePair "rclone-${cmdName}:${replaceIllegalChars sidecarPath}@${remoteName}" ( - mkValue { - inherit - sidecarType - remoteName - sidecar - sidecarPath - isMount - cmdName - ; - } - ) + lib.nameValuePair "rclone-${cmdName}:${replaceIllegalChars sidecarPath}@${remoteName}" (mkValue { + inherit + sidecarType + remoteName + sidecar + sidecarPath + isMount + cmdName + ; + }) ) ) (lib.attrsToList (remote.${sidecarType} or { })) ) (lib.attrsToList cfg.remotes) @@ -331,9 +329,10 @@ in must be provided as file paths to the secrets, which will be read at activation time. - These values are expanded in a shell context within a systemd service, so + These values are expanded in a shell context within the rclone-config + service (a systemd user service on Linux, a launchd agent on macOS), so you can use bash features like command substitution or variable expansion - (e.g. "''${XDG_RUNTIME_DIR}" as used by agenix). + (e.g. "''${XDG_RUNTIME_DIR}" on Linux, as used by agenix). ''; example = lib.literalExpression '' {