2023-07-18 08:44:39 +00:00
|
|
|
{ lib, stdenv, buildGoModule, fetchFromGitHub, buildPackages, installShellFiles
|
2021-04-07 08:41:35 +00:00
|
|
|
, makeWrapper
|
2024-02-26 14:56:08 +00:00
|
|
|
, enableCmount ? true, fuse, fuse3, macfuse-stubs
|
2023-07-07 11:02:29 +00:00
|
|
|
, librclone
|
2021-04-07 08:41:35 +00:00
|
|
|
}:
|
2016-06-30 04:47:43 +00:00
|
|
|
|
2020-09-02 21:21:21 +00:00
|
|
|
buildGoModule rec {
|
2019-02-23 00:35:27 +00:00
|
|
|
pname = "rclone";
|
2024-03-10 14:31:22 +00:00
|
|
|
version = "1.66.0";
|
2016-06-30 04:47:43 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2024-03-10 14:31:22 +00:00
|
|
|
owner = "rclone";
|
|
|
|
repo = "rclone";
|
2016-06-30 04:47:43 +00:00
|
|
|
rev = "v${version}";
|
2024-03-10 14:31:22 +00:00
|
|
|
hash = "sha256-75RnAROICtRUDn95gSCNO0F6wes4CkJteNfUN38GQIY=";
|
2016-06-30 04:47:43 +00:00
|
|
|
};
|
|
|
|
|
2024-03-10 14:31:22 +00:00
|
|
|
vendorHash = "sha256-zGBwgIuabLDqWbutvPHDbPRo5Dd9kNfmgToZXy7KVgI=";
|
2019-04-14 02:08:10 +00:00
|
|
|
|
|
|
|
subPackages = [ "." ];
|
2017-07-23 01:29:21 +00:00
|
|
|
|
2020-04-28 01:50:57 +00:00
|
|
|
outputs = [ "out" "man" ];
|
2019-02-23 00:35:27 +00:00
|
|
|
|
2021-04-07 08:41:35 +00:00
|
|
|
buildInputs = lib.optional enableCmount (if stdenv.isDarwin then macfuse-stubs else fuse);
|
|
|
|
nativeBuildInputs = [ installShellFiles makeWrapper ];
|
2020-04-26 03:16:53 +00:00
|
|
|
|
2021-08-07 04:57:59 +00:00
|
|
|
tags = lib.optionals enableCmount [ "cmount" ];
|
|
|
|
|
|
|
|
ldflags = [ "-s" "-w" "-X github.com/rclone/rclone/fs.Version=${version}" ];
|
2020-09-02 21:21:21 +00:00
|
|
|
|
2020-02-01 11:27:00 +00:00
|
|
|
postInstall =
|
|
|
|
let
|
|
|
|
rcloneBin =
|
2023-03-16 16:14:31 +00:00
|
|
|
if stdenv.buildPlatform.canExecute stdenv.hostPlatform
|
2020-04-28 01:50:57 +00:00
|
|
|
then "$out"
|
2021-01-15 13:21:58 +00:00
|
|
|
else lib.getBin buildPackages.rclone;
|
2020-02-01 11:27:00 +00:00
|
|
|
in
|
2020-09-02 21:21:21 +00:00
|
|
|
''
|
|
|
|
installManPage rclone.1
|
|
|
|
for shell in bash zsh fish; do
|
|
|
|
${rcloneBin}/bin/rclone genautocomplete $shell rclone.$shell
|
|
|
|
installShellCompletion rclone.$shell
|
|
|
|
done
|
2023-10-21 18:45:18 +00:00
|
|
|
|
|
|
|
# filesystem helpers
|
|
|
|
ln -s $out/bin/rclone $out/bin/rclonefs
|
|
|
|
ln -s $out/bin/rclone $out/bin/mount.rclone
|
2022-03-19 19:49:56 +00:00
|
|
|
'' + lib.optionalString (enableCmount && !stdenv.isDarwin)
|
2024-02-26 14:56:08 +00:00
|
|
|
# use --suffix here to ensure we don't shadow /run/wrappers/bin/fusermount3,
|
2022-03-19 19:49:56 +00:00
|
|
|
# as the setuid wrapper is required as non-root on NixOS.
|
|
|
|
''
|
|
|
|
wrapProgram $out/bin/rclone \
|
2024-02-26 14:56:08 +00:00
|
|
|
--suffix PATH : "${lib.makeBinPath [ fuse3 ] }" \
|
|
|
|
--prefix LD_LIBRARY_PATH : "${fuse3}/lib"
|
2020-09-02 21:21:21 +00:00
|
|
|
'';
|
2017-07-23 01:29:21 +00:00
|
|
|
|
2023-07-07 11:02:29 +00:00
|
|
|
passthru.tests = {
|
|
|
|
inherit librclone;
|
|
|
|
};
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2016-06-30 04:47:43 +00:00
|
|
|
description = "Command line program to sync files and directories to and from major cloud storage";
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://rclone.org";
|
2021-01-21 03:41:24 +00:00
|
|
|
changelog = "https://github.com/rclone/rclone/blob/v${version}/docs/content/changelog.md";
|
2017-01-02 22:43:07 +00:00
|
|
|
license = licenses.mit;
|
2023-10-28 20:28:06 +00:00
|
|
|
mainProgram = "rclone";
|
2024-04-27 12:41:20 +00:00
|
|
|
maintainers = with maintainers; [ SuperSandro2000 tomfitzhenry ];
|
2016-06-30 04:47:43 +00:00
|
|
|
};
|
|
|
|
}
|