2023-06-06 11:24:26 +00:00
|
|
|
{ lib, stdenv, fetchFromGitLab, fetchpatch, rustPlatform, pkg-config, openssl
|
2021-04-26 09:42:59 +00:00
|
|
|
, installShellFiles
|
2022-06-24 04:20:00 +00:00
|
|
|
, Security, AppKit
|
2019-03-20 03:51:24 +00:00
|
|
|
|
2024-09-24 15:50:49 +00:00
|
|
|
, x11Support ? stdenv.hostPlatform.isLinux || stdenv.hostPlatform.isBSD
|
2019-03-26 04:09:42 +00:00
|
|
|
, xclip ? null, xsel ? null
|
|
|
|
, preferXsel ? false # if true and xsel is non-null, use it instead of xclip
|
2019-03-17 03:27:17 +00:00
|
|
|
}:
|
|
|
|
|
2019-05-04 21:36:40 +00:00
|
|
|
let
|
2024-09-24 15:50:49 +00:00
|
|
|
usesX11 = stdenv.hostPlatform.isLinux || stdenv.hostPlatform.isBSD;
|
2019-05-04 21:36:40 +00:00
|
|
|
in
|
|
|
|
|
|
|
|
assert (x11Support && usesX11) -> xclip != null || xsel != null;
|
2019-03-20 03:51:24 +00:00
|
|
|
|
2023-04-17 20:27:54 +00:00
|
|
|
rustPlatform.buildRustPackage rec {
|
2019-04-20 05:50:51 +00:00
|
|
|
pname = "ffsend";
|
2022-06-24 04:20:00 +00:00
|
|
|
version = "0.2.76";
|
2019-03-17 03:27:17 +00:00
|
|
|
|
|
|
|
src = fetchFromGitLab {
|
|
|
|
owner = "timvisee";
|
|
|
|
repo = "ffsend";
|
|
|
|
rev = "v${version}";
|
2024-07-13 13:27:47 +00:00
|
|
|
hash = "sha256-L1j1lXPxy9nWMeED9uzQHV5y7XTE6+DB57rDnXa4kMo=";
|
2019-03-17 03:27:17 +00:00
|
|
|
};
|
|
|
|
|
2023-06-06 11:24:26 +00:00
|
|
|
cargoHash = "sha256-r1yIPV2sW/EpHJpdaJyi6pzE+rtNkBIxSUJF+XA8kbA=";
|
|
|
|
|
|
|
|
cargoPatches = [
|
|
|
|
|
|
|
|
# Update dependencies (needed for the below patch to merge cleanly)
|
|
|
|
(fetchpatch {
|
|
|
|
name = "Update-dependencies-1";
|
|
|
|
url = "https://github.com/timvisee/ffsend/commit/afb004680b9ed672c7e87ff23f16bb2c51fea06e.patch";
|
|
|
|
hash = "sha256-eDcbyi05aOq+muVWdLmlLzLXUKcrv/9Y0R+0aHgL4+s=";
|
|
|
|
})
|
|
|
|
|
|
|
|
# Disable unused features in prettytable-rs crate (needed for the below patch to merge cleanly)
|
|
|
|
(fetchpatch {
|
|
|
|
name = "Disable-unused-features";
|
|
|
|
url = "https://github.com/timvisee/ffsend/commit/9b8dee12ea839f911ed207ff9602d929cab5d34b.patch";
|
|
|
|
hash = "sha256-6LK1Fqov+zEbPZ4+B6JCLXtXmgSad9vr9YO2oYodBSM=";
|
|
|
|
})
|
|
|
|
|
|
|
|
# Update dependencies (needed for the below patch to merge cleanly)
|
|
|
|
(fetchpatch {
|
|
|
|
name = "Update-dependencies-2";
|
|
|
|
url = "https://github.com/timvisee/ffsend/commit/fd5b38f9ab9cbc5f962d1024f4809eb36ba8986c.patch";
|
|
|
|
hash = "sha256-BDZKrVtQHpOewmB2Lb6kUfy02swcNK+CYZ3lj3kwFV4=";
|
|
|
|
})
|
|
|
|
|
|
|
|
# Fix seg fault
|
|
|
|
(fetchpatch {
|
|
|
|
name = "Fix-segfault";
|
|
|
|
url = "https://github.com/timvisee/ffsend/commit/3c1c2dc28ca1d88c45f87496a7a96052f5c37858.patch";
|
|
|
|
hash = "sha256-2hWlFXDopNy26Df74nJoB1J8qzPEOpf61wEOEtxOVx8=";
|
|
|
|
})
|
|
|
|
];
|
2019-03-17 03:27:17 +00:00
|
|
|
|
2022-06-24 04:20:00 +00:00
|
|
|
nativeBuildInputs = [ installShellFiles ]
|
2024-09-24 15:50:49 +00:00
|
|
|
++ lib.optionals stdenv.hostPlatform.isLinux [ pkg-config ];
|
2020-05-20 23:17:59 +00:00
|
|
|
buildInputs =
|
2024-09-24 15:50:49 +00:00
|
|
|
if stdenv.hostPlatform.isDarwin then [ Security AppKit ]
|
2020-05-20 23:17:59 +00:00
|
|
|
else [ openssl ];
|
2019-03-17 03:27:17 +00:00
|
|
|
|
2021-01-15 09:19:50 +00:00
|
|
|
preBuild = lib.optionalString (x11Support && usesX11) (
|
2019-03-26 04:09:42 +00:00
|
|
|
if preferXsel && xsel != null then ''
|
|
|
|
export XSEL_PATH="${xsel}/bin/xsel"
|
|
|
|
'' else ''
|
|
|
|
export XCLIP_PATH="${xclip}/bin/xclip"
|
|
|
|
''
|
|
|
|
);
|
2019-03-20 03:51:24 +00:00
|
|
|
|
2019-03-17 03:27:17 +00:00
|
|
|
postInstall = ''
|
2019-09-08 21:58:15 +00:00
|
|
|
installShellCompletion contrib/completions/ffsend.{bash,fish} --zsh contrib/completions/_ffsend
|
2019-03-17 03:27:17 +00:00
|
|
|
'';
|
2019-03-20 03:51:24 +00:00
|
|
|
# There's also .elv and .ps1 completion files but I don't know where to install those
|
2019-03-17 03:27:17 +00:00
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2019-03-17 03:27:17 +00:00
|
|
|
description = "Easily and securely share files from the command line. A fully featured Firefox Send client";
|
|
|
|
longDescription = ''
|
|
|
|
Easily and securely share files and directories from the command line through a safe, private
|
|
|
|
and encrypted link using a single simple command. Files are shared using the Send service and
|
|
|
|
may be up to 2GB. Others are able to download these files with this tool, or through their
|
|
|
|
web browser.
|
|
|
|
'';
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://gitlab.com/timvisee/ffsend";
|
2021-04-23 09:56:44 +00:00
|
|
|
license = licenses.gpl3Only;
|
2024-07-02 19:20:08 +00:00
|
|
|
maintainers = with maintainers; [ equirosa ];
|
2019-05-04 21:36:40 +00:00
|
|
|
platforms = platforms.unix;
|
2023-11-27 01:17:53 +00:00
|
|
|
mainProgram = "ffsend";
|
2019-03-17 03:27:17 +00:00
|
|
|
};
|
|
|
|
}
|