diff --git a/pkgs/applications/networking/sync/rclone/default.nix b/pkgs/applications/networking/sync/rclone/default.nix index cde73fcc7ce..83cc029c089 100644 --- a/pkgs/applications/networking/sync/rclone/default.nix +++ b/pkgs/applications/networking/sync/rclone/default.nix @@ -1,4 +1,7 @@ -{ lib, stdenv, buildGoModule, fetchFromGitHub, buildPackages, installShellFiles }: +{ lib, stdenv, buildGoModule, fetchFromGitHub, buildPackages, installShellFiles +, makeWrapper +, enableCmount ? true, fuse, macfuse-stubs +}: buildGoModule rec { pname = "rclone"; @@ -17,9 +20,11 @@ buildGoModule rec { outputs = [ "out" "man" ]; - nativeBuildInputs = [ installShellFiles ]; + buildInputs = lib.optional enableCmount (if stdenv.isDarwin then macfuse-stubs else fuse); + nativeBuildInputs = [ installShellFiles makeWrapper ]; - buildFlagsArray = [ "-ldflags=-s -w -X github.com/rclone/rclone/fs.Version=${version}" ]; + buildFlagsArray = lib.optionals enableCmount [ "-tags=cmount" ] + ++ [ "-ldflags=-s -w -X github.com/rclone/rclone/fs.Version=${version}" ]; postInstall = let @@ -34,6 +39,8 @@ buildGoModule rec { ${rcloneBin}/bin/rclone genautocomplete $shell rclone.$shell installShellCompletion rclone.$shell done + '' + lib.optionalString (enableCmount && !stdenv.isDarwin) '' + wrapProgram $out/bin/rclone --prefix LD_LIBRARY_PATH : "${fuse}/lib" ''; meta = with lib; {