diff options
author | Artturin <Artturin@artturin.com> | 2024-05-03 23:03:19 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-03 23:03:19 +0300 |
commit | 63885e17132958db13c6af8e57d7cfca0cf8b4b2 (patch) | |
tree | aed9c02ae9aaaccce8a2e0c03aa70a33bd497b0b /pkgs/tools | |
parent | 045a097bde2100af7301e50632a02d0425031042 (diff) | |
parent | 3003affd63807fa02977b5499a4ee4672a7a8266 (diff) |
Merge pull request #308055 from sky1e/vrc-get-completions
vrc-get: Install shell completions
Diffstat (limited to 'pkgs/tools')
-rw-r--r-- | pkgs/tools/misc/vrc-get/default.nix | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/pkgs/tools/misc/vrc-get/default.nix b/pkgs/tools/misc/vrc-get/default.nix index 140fba5c11f30..7f907711e702d 100644 --- a/pkgs/tools/misc/vrc-get/default.nix +++ b/pkgs/tools/misc/vrc-get/default.nix @@ -1,4 +1,4 @@ -{ fetchCrate, lib, rustPlatform, pkg-config, stdenv, Security, SystemConfiguration }: +{ fetchCrate, installShellFiles, lib, rustPlatform, pkg-config, stdenv, Security, SystemConfiguration, buildPackages }: rustPlatform.buildRustPackage rec { pname = "vrc-get"; @@ -9,12 +9,25 @@ rustPlatform.buildRustPackage rec { hash = "sha256-+xbHw1DpFmapjsFoUvxUqTok8TKMebMw3gYjO/rx/iU="; }; - nativeBuildInputs = [ pkg-config ]; + nativeBuildInputs = [ installShellFiles pkg-config ]; buildInputs = lib.optionals stdenv.isDarwin [ Security SystemConfiguration ]; cargoHash = "sha256-iuLhDcii+wXDNUsUMo8lj4kfJve5RAz7FT5Pxs9yFPQ="; + # 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"; |