From 371608e69cb7ffc92321555ec71aada6edeee429 Mon Sep 17 00:00:00 2001 From: Robert Radestock Date: Mon, 3 Nov 2025 04:52:56 +0100 Subject: [PATCH] rclone: add option to set log-level (#8105) Add an option to set rclone's log-level per mount: programs.rclone.remotes..mounts..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 --- modules/programs/rclone.nix | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/modules/programs/rclone.nix b/modules/programs/rclone.nix index 9e92609bb..40fd5790f 100644 --- a/modules/programs/rclone.nix +++ b/modules/programs/rclone.nix @@ -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}"