taplo: add shell completions

- Version 0.10.0 of Taplo CLI added the ability to generate completions
for shells (see https://github.com/tamasfe/taplo/releases/tag/0.10.0).

- This commit adds the generated shell completions to the derivation
output.

- Resolves https://github.com/NixOS/nixpkgs/issues/440875.

+18
+18
pkgs/by-name/ta/taplo/package.nix
··· 1 1 { 2 + stdenv, 2 3 lib, 3 4 rustPlatform, 4 5 fetchCrate, 5 6 pkg-config, 6 7 openssl, 7 8 withLsp ? true, 9 + installShellFiles, 8 10 }: 9 11 10 12 rustPlatform.buildRustPackage rec { ··· 20 22 cargoHash = "sha256-tvijtB5fwOzQnnK/ClIvTbjCcMeqZpXcRdWWKZPIulM="; 21 23 22 24 nativeBuildInputs = [ 25 + installShellFiles 23 26 pkg-config 24 27 ]; 25 28 ··· 28 31 ]; 29 32 30 33 buildFeatures = lib.optional withLsp "lsp"; 34 + 35 + postInstall = 36 + lib.optionalString 37 + ( 38 + stdenv.buildPlatform.canExecute stdenv.hostPlatform 39 + && 40 + # Creation of the completions fails on Darwin platforms. 41 + !stdenv.hostPlatform.isDarwin 42 + ) 43 + '' 44 + installShellCompletion --cmd taplo \ 45 + --bash <($out/bin/taplo completions bash) \ 46 + --fish <($out/bin/taplo completions fish) \ 47 + --zsh <($out/bin/taplo completions zsh) 48 + ''; 31 49 32 50 meta = with lib; { 33 51 description = "TOML toolkit written in Rust";