gitoxide: Install shell completions.

This commit is contained in:
sbatial 2024-02-16 17:11:28 +01:00
parent 1fe7393b79
commit 9c9de33ff2

View File

@ -9,9 +9,14 @@
, SystemConfiguration
, curl
, openssl
, buildPackages
, installShellFiles
}:
rustPlatform.buildRustPackage rec {
let
canRunCmd = stdenv.hostPlatform.emulatorAvailable buildPackages;
gix = "${stdenv.hostPlatform.emulator buildPackages} $out/bin/gix";
in rustPlatform.buildRustPackage rec {
pname = "gitoxide";
version = "0.33.0";
@ -26,10 +31,17 @@ rustPlatform.buildRustPackage rec {
nativeBuildInputs = [ cmake pkg-config ];
buildInputs = [ curl ] ++ (if stdenv.isDarwin
buildInputs = [ curl installShellFiles ] ++ (if stdenv.isDarwin
then [ libiconv Security SystemConfiguration ]
else [ openssl ]);
preFixup = lib.optionalString canRunCmd ''
installShellCompletion --cmd gix \
--bash <(${gix} completions --shell bash) \
--fish <(${gix} completions --shell fish) \
--zsh <(${gix} completions --shell zsh)
'';
# Needed to get openssl-sys to use pkg-config.
env.OPENSSL_NO_VENDOR = 1;