my-nixpkgs/pkgs/bash-pinyin-completion-rs/default.nix
2025-10-17 12:58:04 +08:00

53 lines
1.6 KiB
Nix
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{ lib
, rustPlatform
, fetchFromGitHub
, bash
, bash-completion
, glibc
, gcc
, findutils
}:
rustPlatform.buildRustPackage rec {
pname = "bash-pinyin-completion-rs";
version = "1.0.0-beta";
src = fetchFromGitHub {
owner = "AOSC-Dev";
repo = pname;
rev = "v${version}";
sha256 = "sha256-VXIIG+ZGb4fS3LSIkGW744ui4AKTdQCjrNlObH/YZVY=";
};
#cargoHash = "sha256-VXIIG+ZGb4fS3LSIkGW744ui4AKTdQCjrNlObH/YZVY=";
cargoHash = "sha256-IEtGulY6EqJ74ok1xLY64K1yKSZcmb/wyObtcaHYMRk=";
nativeBuildInputs = [ ];
buildInputs = [ bash bash-completion glibc gcc findutils ];
# Tests are enabled by default; equivalent to Archs `check()`
doCheck = true;
installPhase = ''
runHook preInstall
BIN_PATH=$(${findutils}/bin/find target -type f -executable -name bash-pinyin-completion-rs)
install -Dm755 -t $out/bin/ "$BIN_PATH"
install -Dm644 -t "$out/share/${pname}" scripts/bash_pinyin_completion
runHook postInstall
'';
meta = with lib; {
description = "Simple completion script for pinyin, written in Rust.";
longDescription = ''
Simple completion script for pinyin, written in Rust.
==> Remember to enable bash-pinyin-completion-rs in your .bashrc
==> (add the following line):
source /run/current-system/sw/share/bash-pinyin-completion-rs/bash_pinyin_completion
==> Or if installed via nix profile:
source ~/.nix-profile/share/bash-pinyin-completion-rs/bash_pinyin_completion
'';
homepage = "https://github.com/AOSC-Dev/bash-pinyin-completion-rs";
license = licenses.gpl3Only;
platforms = platforms.linux;
};
}