@@ -1,4 +1,7 @@
1−{ lib, stdenv, buildGoModule, fetchFromGitHub, buildPackages, installShellFiles }:
1+{ lib, stdenv, buildGoModule, fetchFromGitHub, buildPackages, installShellFiles
2+, makeWrapper
3+, enableCmount ? true, fuse, macfuse-stubs
4+}:
25
36buildGoModule rec {
47 pname = "rclone";
@@ -17,9 +20,11 @@ buildGoModule rec {
1720
1821 outputs = [ "out" "man" ];
1922
20− nativeBuildInputs = [ installShellFiles ];
23+ buildInputs = lib.optional enableCmount (if stdenv.isDarwin then macfuse-stubs else fuse);
24+ nativeBuildInputs = [ installShellFiles makeWrapper ];
2125
22− buildFlagsArray = [ "-ldflags=-s -w -X github.com/rclone/rclone/fs.Version=${version}" ];
26+ buildFlagsArray = lib.optionals enableCmount [ "-tags=cmount" ]
27+ ++ [ "-ldflags=-s -w -X github.com/rclone/rclone/fs.Version=${version}" ];
2328
2429 postInstall =
2530 let
@@ -34,6 +39,8 @@ buildGoModule rec {
3439 ${rcloneBin}/bin/rclone genautocomplete $shell rclone.$shell
3540 installShellCompletion rclone.$shell
3641 done
42+ '' + lib.optionalString (enableCmount && !stdenv.isDarwin) ''
43+ wrapProgram $out/bin/rclone --prefix LD_LIBRARY_PATH : "${fuse}/lib"
3744 '';
3845
3946 meta = with lib; {