depot/third_party/nixpkgs/pkgs/tools/networking/xh/default.nix
Default email 3ec2fa6bfd Project import generated by Copybara.
GitOrigin-RevId: 0dde103318090f77ac95ef7fc26fe0cdd00fa0b3
2021-08-06 16:57:35 -05:00

50 lines
1.4 KiB
Nix

{ stdenv, lib, openssl, pkg-config, rustPlatform, fetchFromGitHub, Security
, libiconv, installShellFiles }:
rustPlatform.buildRustPackage rec {
pname = "xh";
version = "0.12.0";
src = fetchFromGitHub {
owner = "ducaale";
repo = "xh";
rev = "v${version}";
sha256 = "sha256-icJBQdFWdiHCYrZ7U90g6CdXdAkv3Y/WJu0IfZAdGv0=";
};
cargoSha256 = "sha256-htv5OQnat4Qi6A6lmVonuz+8/DWz8fOGYPbnCnlizBo=";
nativeBuildInputs = [ installShellFiles pkg-config ];
buildInputs = if stdenv.isDarwin then [ Security libiconv ] else [ openssl ];
# Get openssl-sys to use pkg-config
OPENSSL_NO_VENDOR = 1;
postInstall = ''
installShellCompletion --cmd xh \
--bash completions/xh.bash \
--fish completions/xh.fish \
--zsh completions/_xh
# https://github.com/ducaale/xh#xh-and-xhs
ln -s $out/bin/xh $out/bin/xhs
'';
# Nix build happens in sandbox without internet connectivity
# disable tests as some of them require internet due to nature of application
doCheck = false;
doInstallCheck = true;
postInstallCheck = ''
$out/bin/xh --help > /dev/null
$out/bin/xhs --help > /dev/null
'';
meta = with lib; {
description = "Friendly and fast tool for sending HTTP requests";
homepage = "https://github.com/ducaale/xh";
changelog = "https://github.com/ducaale/xh/blob/v${version}/CHANGELOG.md";
license = licenses.mit;
maintainers = with maintainers; [ payas SuperSandro2000 ];
};
}