summary refs log tree commit diff
path: root/pkgs/tools/networking/xh
diff options
context:
space:
mode:
authorAustin Butler <austinabutler@gmail.com>2021-05-23 19:22:43 -0700
committerAustin Butler <austinabutler@gmail.com>2021-05-23 19:22:43 -0700
commit0fdad731cb788db1b191e278954c6418d0f1bd28 (patch)
tree1154850cc525e8c4fc92cfe2f71e480b42b93b09 /pkgs/tools/networking/xh
parent7e26b2a45583c3804d92e0f31d3b13db1c887d78 (diff)
downloadnixpkgs-0fdad731cb788db1b191e278954c6418d0f1bd28.tar
nixpkgs-0fdad731cb788db1b191e278954c6418d0f1bd28.tar.gz
nixpkgs-0fdad731cb788db1b191e278954c6418d0f1bd28.tar.bz2
nixpkgs-0fdad731cb788db1b191e278954c6418d0f1bd28.tar.lz
nixpkgs-0fdad731cb788db1b191e278954c6418d0f1bd28.tar.xz
nixpkgs-0fdad731cb788db1b191e278954c6418d0f1bd28.tar.zst
nixpkgs-0fdad731cb788db1b191e278954c6418d0f1bd28.zip
xh: add shell completion, xhs symlink
Diffstat (limited to 'pkgs/tools/networking/xh')
-rw-r--r--pkgs/tools/networking/xh/default.nix21
1 files changed, 15 insertions, 6 deletions
diff --git a/pkgs/tools/networking/xh/default.nix b/pkgs/tools/networking/xh/default.nix
index a878a1bd233..0a62fee4bd7 100644
--- a/pkgs/tools/networking/xh/default.nix
+++ b/pkgs/tools/networking/xh/default.nix
@@ -1,5 +1,5 @@
 { stdenv, lib, openssl, pkg-config, rustPlatform, fetchFromGitHub, Security
-, libiconv }:
+, libiconv, installShellFiles }:
 
 rustPlatform.buildRustPackage rec {
   pname = "xh";
@@ -9,19 +9,27 @@ rustPlatform.buildRustPackage rec {
     owner = "ducaale";
     repo = "xh";
     rev = "v${version}";
-    sha256 = "sha256-eOP9sc1qmQuc3HecNNZDMarVkXmEfGZkan0H9598LC0=";
+    sha256 = "0b9cgjgzf1vxd9j6cz44g68xbaii8gb3973pvjf0p6barnqzvqvq";
   };
 
-  cargoSha256 = "sha256-JXywHuZPQVhuWBVUNi9k8TwgE8KCNDtucjxxDi6unVM=";
+  cargoSha256 = "0lwxmqp0ww9wf9p3nd42q89j0g7ichpkcm0mb1p5hhagwqgb0z15";
 
-  nativeBuildInputs = [ pkg-config ];
+  nativeBuildInputs = [ installShellFiles pkg-config ];
 
   buildInputs = if stdenv.isDarwin then [ Security libiconv ] else [ openssl ];
 
   # Get openssl-sys to use pkg-config
   OPENSSL_NO_VENDOR = 1;
 
-  checkFlagsArray = [ "--skip=basic_options" ];
+  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
@@ -29,10 +37,11 @@ rustPlatform.buildRustPackage rec {
   doInstallCheck = true;
   postInstallCheck = ''
     $out/bin/xh --help > /dev/null
+    $out/bin/xhs --help > /dev/null
   '';
 
   meta = with lib; {
-    description = "Yet another HTTPie clone in Rust";
+    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;