From de679c57ca579974f35fab5444c7892ceb16230a Mon Sep 17 00:00:00 2001 From: midchildan Date: Wed, 7 Apr 2021 17:41:35 +0900 Subject: [PATCH] rclone: build with 'cmount' support (#117119) Co-authored-by: Sandro --- .../applications/networking/sync/rclone/default.nix | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) 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; {