2021-03-20 04:20:00 +00:00
|
|
|
{ stdenv, lib, openssl, pkg-config, rustPlatform, fetchFromGitHub, Security
|
2021-05-28 09:39:13 +00:00
|
|
|
, libiconv, installShellFiles }:
|
2021-02-13 14:23:35 +00:00
|
|
|
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "xh";
|
2021-08-06 21:57:35 +00:00
|
|
|
version = "0.12.0";
|
2021-02-13 14:23:35 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "ducaale";
|
|
|
|
repo = "xh";
|
|
|
|
rev = "v${version}";
|
2021-08-06 21:57:35 +00:00
|
|
|
sha256 = "sha256-icJBQdFWdiHCYrZ7U90g6CdXdAkv3Y/WJu0IfZAdGv0=";
|
2021-02-13 14:23:35 +00:00
|
|
|
};
|
|
|
|
|
2021-08-06 21:57:35 +00:00
|
|
|
cargoSha256 = "sha256-htv5OQnat4Qi6A6lmVonuz+8/DWz8fOGYPbnCnlizBo=";
|
2021-02-13 14:23:35 +00:00
|
|
|
|
2021-05-28 09:39:13 +00:00
|
|
|
nativeBuildInputs = [ installShellFiles pkg-config ];
|
2021-03-20 04:20:00 +00:00
|
|
|
|
|
|
|
buildInputs = if stdenv.isDarwin then [ Security libiconv ] else [ openssl ];
|
|
|
|
|
|
|
|
# Get openssl-sys to use pkg-config
|
|
|
|
OPENSSL_NO_VENDOR = 1;
|
2021-02-13 14:23:35 +00:00
|
|
|
|
2021-05-28 09:39:13 +00:00
|
|
|
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
|
|
|
|
'';
|
2021-02-13 14:23:35 +00:00
|
|
|
|
2021-03-20 04:20:00 +00:00
|
|
|
# Nix build happens in sandbox without internet connectivity
|
|
|
|
# disable tests as some of them require internet due to nature of application
|
|
|
|
doCheck = false;
|
2021-02-13 14:23:35 +00:00
|
|
|
doInstallCheck = true;
|
|
|
|
postInstallCheck = ''
|
|
|
|
$out/bin/xh --help > /dev/null
|
2021-05-28 09:39:13 +00:00
|
|
|
$out/bin/xhs --help > /dev/null
|
2021-02-13 14:23:35 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
2021-05-28 09:39:13 +00:00
|
|
|
description = "Friendly and fast tool for sending HTTP requests";
|
2021-02-13 14:23:35 +00:00
|
|
|
homepage = "https://github.com/ducaale/xh";
|
2021-02-16 17:04:54 +00:00
|
|
|
changelog = "https://github.com/ducaale/xh/blob/v${version}/CHANGELOG.md";
|
2021-02-13 14:23:35 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ payas SuperSandro2000 ];
|
|
|
|
};
|
|
|
|
}
|