mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-27 01:13:05 +00:00
1862813d11
This is done with the following bash script: ``` #!/usr/bin/env bash process_line() { local filename=${1%:} if [[ $4 =~ \"(.*)\"\; ]]; then local sha256="${BASH_REMATCH[1]}" fi [[ -z $sha256 ]] && return 0 local hash=$(nix hash to-sri --type sha256 $sha256) echo "Processing: $filename" echo " $sha256 => $hash" sed -i "s|cargoSha256 = \"$sha256\"|cargoHash = \"$hash\"|" $filename } # split output by line grep -r 'cargoSha256 = ' . | while IFS= read -r line; do # split them further by space read -r -a parts <<< "$line" process_line "${parts[@]}" done ```
26 lines
744 B
Nix
26 lines
744 B
Nix
{ stdenv, lib, rustPlatform, fetchFromGitHub, Security }:
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
pname = "pinyin-tool";
|
|
version = "0.1.3";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "briankung";
|
|
repo = pname;
|
|
rev = version;
|
|
sha256 = "1gwqwxlvdrm4sdyqkvpvvfi6jh6qqn6qybn0z66wm06k62f8zj5b";
|
|
};
|
|
|
|
cargoHash = "sha256-jeRKtKv8Lg/ritl42dMbEQpXaNlCIaHTrw0xtPQitMc=";
|
|
|
|
buildInputs = lib.optionals stdenv.isDarwin [ Security ];
|
|
|
|
meta = with lib; {
|
|
description = "Simple command line tool for converting Chinese characters to space-separate pinyin words";
|
|
mainProgram = "pinyin-tool";
|
|
homepage = "https://github.com/briankung/pinyin-tool";
|
|
license = licenses.mit;
|
|
maintainers = with maintainers; [ neonfuz ];
|
|
};
|
|
}
|