diff --git a/flake.lock b/flake.lock index 0b7277b..55f120b 100644 --- a/flake.lock +++ b/flake.lock @@ -2,8 +2,8 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1759143120, - "narHash": "sha256-Lz9jvhswQu/niKVttNvOds0w+OS+2x63NivPVJng5G4=", + "lastModified": 1760573772, + "narHash": "sha256-RoIm6fgfvnkNQldHrbBhtAaFyiWJV5KF4D0dI41Fr90=", "type": "tarball", "url": "https://mirrors.cernet.edu.cn/nix-channels/nixos-unstable/nixexprs.tar.xz" }, diff --git a/pkgs/bash-pinyin-completion-rs/default.nix b/pkgs/bash-pinyin-completion-rs/default.nix new file mode 100644 index 0000000..7d1a0cd --- /dev/null +++ b/pkgs/bash-pinyin-completion-rs/default.nix @@ -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 Arch’s `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; + }; +}