diff --git a/modules/programs/rclone.nix b/modules/programs/rclone.nix index 4af20eb12..10a40f446 100644 --- a/modules/programs/rclone.nix +++ b/modules/programs/rclone.nix @@ -92,7 +92,12 @@ let Type = if !isMount && !(builtins.elem sidecar.protocol serveProtocolNotifies) then "simple" else "notify"; Environment = - (lib.optional isMount "PATH=/run/wrappers/bin") + # PATH is set explicitly so fusermount/fusermount3 is found on both + # NixOS (/run/wrappers/bin) and standalone home-manager hosts running + # other Linux distros (where the FUSE setuid helper lives in standard + # /usr or /sbin paths). Setting Environment=PATH= replaces systemd's + # inherited PATH, so we must enumerate the non-NixOS locations too. + (lib.optional isMount "PATH=/run/wrappers/bin:/run/current-system/sw/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin") ++ lib.optional (sidecar.logLevel != null) "RCLONE_LOG_LEVEL=${sidecar.logLevel}"; SuccessExitStatus = "143"; diff --git a/tests/modules/programs/rclone/mount-service-generation.nix b/tests/modules/programs/rclone/mount-service-generation.nix index 79c175da2..9872374fa 100644 --- a/tests/modules/programs/rclone/mount-service-generation.nix +++ b/tests/modules/programs/rclone/mount-service-generation.nix @@ -34,7 +34,7 @@ _: { assertFileContains "$service" "rclone mount '--cache-dir=%C/rclone' '--dir-cache-time=5000h' '--poll-interval=10s' '--umask=002' '--vfs-cache-mode=full' sftp-remote:documents/work /home/alice/mounts/work-docs" assertFileContains "$service" "mkdir -p /home/alice/mounts/work-docs" assertFileContains "$service" "RCLONE_LOG_LEVEL=INFO" - assertFileContains "$service" "PATH=/run/wrappers/bin" + assertFileContains "$service" "PATH=/run/wrappers/bin:/run/current-system/sw/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" assertFileContains "$service" "Rclone FUSE daemon for sftp-remote:documents/work" assertFileContains "$service" "Type=notify"