From c43839f8263700aeefea6974f73aa6a25b3e60f5 Mon Sep 17 00:00:00 2001 From: Pavel Ivanov Date: Wed, 25 Dec 2024 22:02:16 +0100 Subject: [PATCH] feat(nix): install shell completions and man page --- Cargo.lock | 2 +- Cargo.toml | 2 +- nix/package.nix | 21 ++++++++++++++++++--- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f0c25954..b14a50ed 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -958,7 +958,7 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "hl" -version = "0.30.1-alpha.2" +version = "0.30.1-alpha.3" dependencies = [ "bincode", "byte-strings", diff --git a/Cargo.toml b/Cargo.toml index 3ac80049..3579f529 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ members = [".", "crate/encstr"] [workspace.package] repository = "https://github.com/pamburus/hl" authors = ["Pavel Ivanov "] -version = "0.30.1-alpha.2" +version = "0.30.1-alpha.3" edition = "2021" license = "MIT" diff --git a/nix/package.nix b/nix/package.nix index 5e79dac1..745e483c 100644 --- a/nix/package.nix +++ b/nix/package.nix @@ -1,6 +1,8 @@ -{ lib -, rustPlatform -, +{ + lib, + stdenv, + rustPlatform, + installShellFiles, }: let cargoToml = builtins.fromTOML (builtins.readFile ../Cargo.toml); @@ -21,6 +23,19 @@ rustPlatform.buildRustPackage { }; }; + nativeBuildInputs = [ installShellFiles ]; + + postInstall = '' + installShellCompletion --cmd hl \ + --bash <($out/bin/hl --shell-completions bash) \ + --fish <($out/bin/hl --shell-completions fish) \ + --zsh <($out/bin/hl --shell-completions zsh) + $out/bin/hl --man-page >hl.1 + installManPage hl.1 + ''; + + doCheck = false; + meta = { description = cargoToml.package.description; homepage = cargoToml.workspace.package.repository;