nixpkgs/pkgs/by-name/vr/vrc-get/package.nix

49 lines
1.3 KiB
Nix

{
fetchCrate,
installShellFiles,
lib,
rustPlatform,
pkg-config,
stdenv,
buildPackages,
}:
rustPlatform.buildRustPackage rec {
pname = "vrc-get";
version = "1.9.0";
src = fetchCrate {
inherit pname version;
hash = "sha256-gZtaeq/PDVFZPIMH/cB/ZJNP+SbksPPbz8L8Hc7FDM8=";
};
nativeBuildInputs = [
installShellFiles
pkg-config
];
useFetchCargoVendor = true;
cargoHash = "sha256-cG6fcSIQ0E1htEM4H914SSKDNRGM5fj52SUoLqRYzoc=";
# Execute the resulting binary to generate shell completions, using emulation if necessary when cross-compiling.
# If no emulator is available, then give up on generating shell completions
postInstall =
let
vrc-get = "${stdenv.hostPlatform.emulator buildPackages} $out/bin/vrc-get";
in
lib.optionalString (stdenv.hostPlatform.emulatorAvailable buildPackages) ''
installShellCompletion --cmd vrc-get \
--bash <(${vrc-get} completion bash) \
--fish <(${vrc-get} completion fish) \
--zsh <(${vrc-get} completion zsh)
'';
meta = with lib; {
description = "Command line client of VRChat Package Manager, the main feature of VRChat Creator Companion (VCC)";
homepage = "https://github.com/vrc-get/vrc-get";
license = licenses.mit;
maintainers = with maintainers; [ bddvlpr ];
mainProgram = "vrc-get";
};
}