From 7820260cbbf523230b2cd5a8794ee16629cd587b Mon Sep 17 00:00:00 2001 From: a-kenji Date: Mon, 22 Dec 2025 13:50:03 +0100 Subject: [PATCH] treefmt: add shell completions --- pkgs/by-name/tr/treefmt/package.nix | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkgs/by-name/tr/treefmt/package.nix b/pkgs/by-name/tr/treefmt/package.nix index e38f05966a46..a340205e60bf 100644 --- a/pkgs/by-name/tr/treefmt/package.nix +++ b/pkgs/by-name/tr/treefmt/package.nix @@ -1,8 +1,10 @@ { lib, + stdenv, buildGoModule, callPackages, fetchFromGitHub, + installShellFiles, }: buildGoModule rec { pname = "treefmt"; @@ -28,6 +30,15 @@ buildGoModule rec { "-X github.com/numtide/treefmt/v2/build.Version=v${version}" ]; + nativeBuildInputs = [ installShellFiles ]; + + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' + installShellCompletion --cmd treefmt \ + --bash <($out/bin/treefmt --completion bash) \ + --fish <($out/bin/treefmt --completion fish) \ + --zsh <($out/bin/treefmt --completion zsh) + ''; + passthru = { inherit (callPackages ./lib.nix { }) evalConfig