summary refs log tree commit diff
path: root/pkgs/applications/networking/sync/rclone/default.nix
diff options
context:
space:
mode:
authormidchildan <git@midchildan.org>2021-04-07 17:41:35 +0900
committerGitHub <noreply@github.com>2021-04-07 10:41:35 +0200
commitde679c57ca579974f35fab5444c7892ceb16230a (patch)
tree4ccf45f6f77c03ba8e4da66cdbea4f999a3f6b08 /pkgs/applications/networking/sync/rclone/default.nix
parentb219457ac0de8e9e45e8b8c8643f21a149a4e2a0 (diff)
downloadnixpkgs-de679c57ca579974f35fab5444c7892ceb16230a.tar
nixpkgs-de679c57ca579974f35fab5444c7892ceb16230a.tar.gz
nixpkgs-de679c57ca579974f35fab5444c7892ceb16230a.tar.bz2
nixpkgs-de679c57ca579974f35fab5444c7892ceb16230a.tar.lz
nixpkgs-de679c57ca579974f35fab5444c7892ceb16230a.tar.xz
nixpkgs-de679c57ca579974f35fab5444c7892ceb16230a.tar.zst
nixpkgs-de679c57ca579974f35fab5444c7892ceb16230a.zip
rclone: build with 'cmount' support (#117119)
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
Diffstat (limited to 'pkgs/applications/networking/sync/rclone/default.nix')
-rw-r--r--pkgs/applications/networking/sync/rclone/default.nix13
1 files 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; {