diff --git a/lib/modules/rclone.nix b/lib/modules/rclone.nix index acc0595..9519bc7 100644 --- a/lib/modules/rclone.nix +++ b/lib/modules/rclone.nix @@ -122,6 +122,18 @@ let description = "The path to a file containing the password obscured using the `rclone obscure` command for logging in to the ${displayName} server."; default = null; }; + + bearerToken = lib.mkOption { + type = lib.types.nullOr lib.types.str; + description = "The bearer token for logging in to the ${displayName} server."; + default = null; + }; + + bearerTokenFile = lib.mkOption { + type = lib.types.nullOr (lib.types.either lib.types.path lib.types.str); + description = "The path to a file containing the bearer token for logging in to the ${displayName} server."; + default = null; + }; }; config = { @@ -130,11 +142,14 @@ let (mkIfNotNull config.vendor { inherit (config) vendor; }) (mkIfNotNull config.username { user = config.username; }) (mkIfNotNull config.obscuredPassword { pass = config.obscuredPassword; }) + (mkIfNotNull config.bearerToken { bearer_token = config.bearerToken; }) ]; - secrets = lib.optionalAttrs (config.obscuredPasswordFile != null) { + secrets = (lib.optionalAttrs (config.obscuredPasswordFile != null) { RCLONE_WEBDAV_PASS = config.obscuredPasswordFile; - }; + }) // (lib.optionalAttrs (config.bearerTokenFile != null) { + RCLONE_WEBDAV_BEARER_TOKEN = config.bearerTokenFile; + }); }; }));