nixpkgs/pkgs/tools/misc/ffsend/default.nix
Profpatsch 4a7f99d55d treewide: with stdenv.lib; in meta -> with lib;
Part of: https://github.com/NixOS/nixpkgs/issues/108938

meta = with stdenv.lib;

is a widely used pattern. We want to slowly remove
the `stdenv.lib` indirection and encourage people
to use `lib` directly. Thus let’s start with the meta
field.

This used a rewriting script to mostly automatically
replace all occurances of this pattern, and add the
`lib` argument to the package header if it doesn’t
exist yet.

The script in its current form is available at
https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
2021-01-11 10:38:22 +01:00

62 lines
2 KiB
Nix

{ lib, stdenv, fetchFromGitLab, rustPlatform, cmake, pkgconfig, openssl
, darwin, installShellFiles
, x11Support ? stdenv.isLinux || stdenv.hostPlatform.isBSD
, xclip ? null, xsel ? null
, preferXsel ? false # if true and xsel is non-null, use it instead of xclip
}:
let
usesX11 = stdenv.isLinux || stdenv.hostPlatform.isBSD;
in
assert (x11Support && usesX11) -> xclip != null || xsel != null;
with rustPlatform;
buildRustPackage rec {
pname = "ffsend";
version = "0.2.68";
src = fetchFromGitLab {
owner = "timvisee";
repo = "ffsend";
rev = "v${version}";
sha256 = "0ga1v4s8ks2v632mim8ljya0gi2j8bbwj98yfm3g00p0z1i526qk";
};
cargoSha256 = "1n9pf29xid6jcas5yx94k4cpmqgx0kpqq7gwf83jisjywxzygh6w";
nativeBuildInputs = [ cmake pkgconfig installShellFiles ];
buildInputs =
if stdenv.isDarwin then (with darwin.apple_sdk.frameworks; [ CoreFoundation CoreServices Security AppKit ])
else [ openssl ];
preBuild = stdenv.lib.optionalString (x11Support && usesX11) (
if preferXsel && xsel != null then ''
export XSEL_PATH="${xsel}/bin/xsel"
'' else ''
export XCLIP_PATH="${xclip}/bin/xclip"
''
);
postInstall = ''
installShellCompletion contrib/completions/ffsend.{bash,fish} --zsh contrib/completions/_ffsend
'';
# There's also .elv and .ps1 completion files but I don't know where to install those
meta = with lib; {
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.
'';
homepage = "https://gitlab.com/timvisee/ffsend";
license = licenses.gpl3;
maintainers = with maintainers; [ lilyball equirosa ];
platforms = platforms.unix;
};
}