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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

65 lines
1.6 KiB
Nix
Raw Normal View History

{ lib
, rustPlatform
, fetchFromGitHub
, installShellFiles
, pkg-config
, withNativeTls ? true
, stdenv
, Security
, openssl
}:
rustPlatform.buildRustPackage rec {
pname = "xh";
version = "0.18.0";
src = fetchFromGitHub {
owner = "ducaale";
repo = "xh";
rev = "v${version}";
sha256 = "sha256-2qZ+FGc8Y8HLJaQluVv036NG77lvaqsc3I5cmkD+r/M=";
};
cargoSha256 = "sha256-0lPEZ8Th3PAw6AEnb+ciKMhi5wysFCvYwiHd9/o8VVc=";
buildFeatures = lib.optional withNativeTls "native-tls";
2021-05-24 02:22:43 +00:00
nativeBuildInputs = [ installShellFiles pkg-config ];
2021-03-21 03:35:48 +00:00
buildInputs = lib.optionals withNativeTls
(if stdenv.isDarwin then [ Security ] else [ openssl ]);
2021-03-21 03:35:48 +00:00
# Get openssl-sys to use pkg-config
OPENSSL_NO_VENDOR = 1;
2021-05-24 02:22:43 +00:00
postInstall = ''
installShellCompletion \
completions/xh.{bash,fish} \
2021-05-24 02:22:43 +00:00
--zsh completions/_xh
installManPage doc/xh.1
ln -s $out/share/man/man1/xh.1 $out/share/man/man1/xhs.1
install -m444 -Dt $out/share/doc/xh README.md CHANGELOG.md
2021-05-24 02:22:43 +00:00
ln -s $out/bin/xh $out/bin/xhs
'';
2021-03-21 03:35:48 +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;
doInstallCheck = true;
postInstallCheck = ''
$out/bin/xh --help > /dev/null
2021-05-24 02:22:43 +00:00
$out/bin/xhs --help > /dev/null
'';
meta = with lib; {
2021-05-24 02:22:43 +00:00
description = "Friendly and fast tool for sending HTTP requests";
homepage = "https://github.com/ducaale/xh";
2021-02-15 09:45:36 +00:00
changelog = "https://github.com/ducaale/xh/blob/v${version}/CHANGELOG.md";
license = licenses.mit;
maintainers = with maintainers; [ figsoda payas ];
};
}