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