1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 11:36:05 +01:00

rclone: add option to set log-level (#8105)

Add an option to set rclone's log-level per mount:
programs.rclone.remotes.<name>.mounts.<name>.logLevel = "DEBUG";
If no value is set, it'll use rclone's implicit default ("NOTICE")

Previously, the debug log-level got enforced (via "-vv"),
which caused noisy logs, and there was no easy way to change that.

Note: rclone global-flags can't be configured in the config file,
so this uses the environment variable approach.

references:
- https://rclone.org/docs/#logging
- https://rclone.org/docs/#v-vv-verbose

If no value is given, use the implicit default of rclone instead of redefining it through the options
This commit is contained in:
Robert Radestock 2025-11-03 04:52:56 +01:00 committed by GitHub
parent 43e205606a
commit 371608e69c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -111,6 +111,23 @@ in
options = {
enable = lib.mkEnableOption "this mount";
logLevel = lib.mkOption {
type = lib.types.nullOr (
lib.types.enum [
"ERROR"
"NOTICE"
"INFO"
"DEBUG"
]
);
default = null;
example = "INFO";
description = ''
Set the log-level.
See: https://rclone.org/docs/#logging
'';
};
mountPoint = lib.mkOption {
type = lib.types.str;
default = null;
@ -348,12 +365,13 @@ in
Environment = [
# fusermount/fusermount3
"PATH=/run/wrappers/bin"
];
]
++ lib.optional (mount.logLevel != null) "RCLONE_LOG_LEVEL=${mount.logLevel}";
ExecStartPre = "${pkgs.coreutils}/bin/mkdir -p ${mount.mountPoint}";
ExecStart = lib.concatStringsSep " " [
(lib.getExe cfg.package)
"mount"
"-vv"
(lib.cli.toGNUCommandLineShell { } mount.options)
"${remote-name}:${mount-path}"
"${mount.mountPoint}"