From c6c76abb2a0e9ceeb6d9a5a610ed7d1d62b3612a Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Sat, 5 Oct 2024 18:14:45 +0200 Subject: [PATCH] git-cliff: Add man page and shell completion --- .../version-management/git-cliff/default.nix | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/pkgs/applications/version-management/git-cliff/default.nix b/pkgs/applications/version-management/git-cliff/default.nix index 25bcf4f1ca7c..5725526e8f3d 100644 --- a/pkgs/applications/version-management/git-cliff/default.nix +++ b/pkgs/applications/version-management/git-cliff/default.nix @@ -4,6 +4,7 @@ , rustPlatform , Security , SystemConfiguration +, installShellFiles }: rustPlatform.buildRustPackage rec { @@ -26,6 +27,23 @@ rustPlatform.buildRustPackage rec { Security SystemConfiguration ]; + nativeBuildInputs = [ installShellFiles ]; + + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' + export OUT_DIR=$(mktemp -d) + + # Generate shell completions + $out/bin/git-cliff-completions + installShellCompletion \ + --bash $OUT_DIR/git-cliff.bash \ + --fish $OUT_DIR/git-cliff.fish \ + --zsh $OUT_DIR/_git-cliff + + # Generate man page + $out/bin/git-cliff-mangen + installManPage $OUT_DIR/git-cliff.1 + ''; + meta = with lib; { description = "Highly customizable Changelog Generator that follows Conventional Commit specifications"; homepage = "https://github.com/orhun/git-cliff";