kdlfmt: install shell completions

This commit is contained in:
Defelo
2025-06-22 15:03:28 +02:00
parent 0f5114eaaf
commit 9613eaa68c
+11
View File
@@ -2,6 +2,8 @@
lib,
rustPlatform,
fetchFromGitHub,
stdenv,
installShellFiles,
}:
rustPlatform.buildRustPackage (finalAttrs: {
@@ -18,6 +20,15 @@ rustPlatform.buildRustPackage (finalAttrs: {
useFetchCargoVendor = true;
cargoHash = "sha256-xoOnFJqDucg3fUDx5XbXsZT4rSjZhzt5rNbH+DZ1kGA=";
nativeBuildInputs = [ installShellFiles ];
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
installShellCompletion --cmd kdlfmt \
--bash <($out/bin/kdlfmt completions bash) \
--fish <($out/bin/kdlfmt completions fish) \
--zsh <($out/bin/kdlfmt completions zsh)
'';
meta = {
description = "Formatter for kdl documents";
homepage = "https://github.com/hougesen/kdlfmt";