nixpkgs/pkgs/tools/networking/xh/default.nix

62 lines
1.6 KiB
Nix
Raw Normal View History

{ stdenv
, lib
, pkg-config
, rustPlatform
, fetchFromGitHub
, installShellFiles
, withNativeTls ? true
, Security
, libiconv
, openssl }:
rustPlatform.buildRustPackage rec {
pname = "xh";
2022-01-29 03:41:06 +03:00
version = "0.15.0";
src = fetchFromGitHub {
owner = "ducaale";
repo = "xh";
rev = "v${version}";
2022-01-29 03:41:06 +03:00
sha256 = "sha256-+GiVehgU0g/rHeikSyACbTdCdpjHd8WxjkP+uxCylnY=";
};
2022-01-29 03:41:06 +03:00
cargoSha256 = "sha256-G3jaM6U7O+GLAiAbaWMIyh6Ksu4ypTK50s/RNe2wT3c=";
buildFeatures = lib.optional withNativeTls "native-tls";
2021-05-24 05:22:43 +03:00
nativeBuildInputs = [ installShellFiles pkg-config ];
2021-03-21 06:35:48 +03:00
buildInputs = lib.optionals withNativeTls
(if stdenv.isDarwin then [ Security libiconv ] else [ openssl ]);
2021-03-21 06:35:48 +03:00
# Get openssl-sys to use pkg-config
OPENSSL_NO_VENDOR = 1;
2021-05-24 05:22:43 +03: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-03-21 06:35:48 +03:00
# 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
2021-05-24 05:22:43 +03:00
$out/bin/xhs --help > /dev/null
'';
meta = with lib; {
2021-05-24 05:22:43 +03:00
description = "Friendly and fast tool for sending HTTP requests";
homepage = "https://github.com/ducaale/xh";
2021-02-15 12:45:36 +03:00
changelog = "https://github.com/ducaale/xh/blob/v${version}/CHANGELOG.md";
license = licenses.mit;
maintainers = with maintainers; [ payas SuperSandro2000 ];
};
}