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 { 2 lib, 3 rustPlatform, 4 fetchCrate, 5 pkg-config, 6 openssl, 7 withLsp ? true, 8 }: 9 10 rustPlatform.buildRustPackage rec { ··· 20 cargoHash = "sha256-tvijtB5fwOzQnnK/ClIvTbjCcMeqZpXcRdWWKZPIulM="; 21 22 nativeBuildInputs = [ 23 pkg-config 24 ]; 25 ··· 28 ]; 29 30 buildFeatures = lib.optional withLsp "lsp"; 31 32 meta = with lib; { 33 description = "TOML toolkit written in Rust";
··· 1 { 2 + stdenv, 3 lib, 4 rustPlatform, 5 fetchCrate, 6 pkg-config, 7 openssl, 8 withLsp ? true, 9 + installShellFiles, 10 }: 11 12 rustPlatform.buildRustPackage rec { ··· 22 cargoHash = "sha256-tvijtB5fwOzQnnK/ClIvTbjCcMeqZpXcRdWWKZPIulM="; 23 24 nativeBuildInputs = [ 25 + installShellFiles 26 pkg-config 27 ]; 28 ··· 31 ]; 32 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 + ''; 49 50 meta = with lib; { 51 description = "TOML toolkit written in Rust";