bash-pinyin-completion-rs: init

flake.lock: update
This commit is contained in:
ZMSUN 2025-10-17 12:54:40 +08:00
parent 02dc79ba3e
commit 234d6c0325
Signed by: zm
GPG key ID: 9887E5061F495C4C
2 changed files with 55 additions and 2 deletions

4
flake.lock generated
View file

@ -2,8 +2,8 @@
"nodes": { "nodes": {
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1759143120, "lastModified": 1760573772,
"narHash": "sha256-Lz9jvhswQu/niKVttNvOds0w+OS+2x63NivPVJng5G4=", "narHash": "sha256-RoIm6fgfvnkNQldHrbBhtAaFyiWJV5KF4D0dI41Fr90=",
"type": "tarball", "type": "tarball",
"url": "https://mirrors.cernet.edu.cn/nix-channels/nixos-unstable/nixexprs.tar.xz" "url": "https://mirrors.cernet.edu.cn/nix-channels/nixos-unstable/nixexprs.tar.xz"
}, },

View file

@ -0,0 +1,53 @@
{ 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;
};
}