nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitLab,
5 fetchpatch,
6 rustPlatform,
7 pkg-config,
8 openssl,
9 installShellFiles,
10
11 x11Support ? stdenv.hostPlatform.isLinux || stdenv.hostPlatform.isBSD,
12 xclip ? null,
13 xsel ? null,
14 preferXsel ? false, # if true and xsel is non-null, use it instead of xclip
15}:
16
17let
18 usesX11 = stdenv.hostPlatform.isLinux || stdenv.hostPlatform.isBSD;
19in
20
21assert (x11Support && usesX11) -> xclip != null || xsel != null;
22
23rustPlatform.buildRustPackage rec {
24 pname = "ffsend";
25 version = "0.2.77";
26
27 src = fetchFromGitLab {
28 owner = "timvisee";
29 repo = "ffsend";
30 tag = "v${version}";
31 hash = "sha256-qq1nLNe4ddcsFJZaGfNQbNtqchz6tPh1kpEH/oDW3jk=";
32 };
33
34 cargoHash = "sha256-DQcuyp61r0y9fi8AV33qxN2cOrl0M8q4/VoXuV47gxQ=";
35
36 cargoPatches = [
37 # https://gitlab.com/timvisee/ffsend/-/merge_requests/44
38 (fetchpatch {
39 name = "rust-1.87.0-compat.patch";
40 url = "https://gitlab.com/timvisee/ffsend/-/commit/29eb167d4367929a2546c20b3f2bbf890b63c631.patch";
41 hash = "sha256-BxJ+0QJP2fzQT1X3BZG1Yy9V+csIEk8xocUKSBgdG9M=";
42 })
43 ];
44
45 nativeBuildInputs = [
46 installShellFiles
47 ]
48 ++ lib.optionals stdenv.hostPlatform.isLinux [ pkg-config ];
49 buildInputs = lib.optionals (!stdenv.hostPlatform.isDarwin) [ openssl ];
50
51 preBuild = lib.optionalString (x11Support && usesX11) (
52 if preferXsel && xsel != null then
53 ''
54 export XSEL_PATH="${xsel}/bin/xsel"
55 ''
56 else
57 ''
58 export XCLIP_PATH="${xclip}/bin/xclip"
59 ''
60 );
61
62 postInstall = ''
63 installShellCompletion contrib/completions/ffsend.{bash,fish} --zsh contrib/completions/_ffsend
64 '';
65 # There's also .elv and .ps1 completion files but I don't know where to install those
66
67 meta = {
68 description = "Easily and securely share files from the command line. A fully featured Firefox Send client";
69 longDescription = ''
70 Easily and securely share files and directories from the command line through a safe, private
71 and encrypted link using a single simple command. Files are shared using the Send service and
72 may be up to 2GB. Others are able to download these files with this tool, or through their
73 web browser.
74 '';
75 homepage = "https://gitlab.com/timvisee/ffsend";
76 license = lib.licenses.gpl3Only;
77 maintainers = with lib.maintainers; [ equirosa ];
78 platforms = lib.platforms.unix;
79 mainProgram = "ffsend";
80 };
81}