This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

pkgs.vosk: 0.3.44 -> 0.3.45 (linux), add updateScript

+76 -25
+11 -25
pkgs/vosk/package.nix
··· 6 6 autoPatchelfHook, 7 7 }: 8 8 let 9 - version = "0.3.44"; 10 - 11 - # Platform-specific wheels 12 - wheels = { 13 - "x86_64-linux" = { 14 - url = "https://files.pythonhosted.org/packages/py3/v/vosk/vosk-${version}-py3-none-manylinux_2_12_x86_64.manylinux2010_x86_64.whl"; 15 - hash = "sha256-JlLvITxMeAfcQK8eeqV43Mz8TcQZKCKia8RalZG8v3Y="; 16 - }; 17 - "aarch64-linux" = { 18 - url = "https://files.pythonhosted.org/packages/py3/v/vosk/vosk-${version}-py3-none-manylinux2014_aarch64.whl"; 19 - hash = "sha256-mZW3+lQ0sTS0vQmJfiSQ28VhFcKtKUPAMGIeEMcDezQ="; 20 - }; 21 - "x86_64-darwin" = { 22 - url = "https://files.pythonhosted.org/packages/py3/v/vosk/vosk-${version}-py3-none-macosx_10_6_universal2.whl"; 23 - hash = "sha256-Ap0LPWpc/4dMV1uKWBSkzM+zdgjP9S6EbAKoxnqIKAE="; 24 - }; 25 - "aarch64-darwin" = { 26 - url = "https://files.pythonhosted.org/packages/py3/v/vosk/vosk-${version}-py3-none-macosx_10_6_universal2.whl"; 27 - hash = "sha256-Ap0LPWpc/4dMV1uKWBSkzM+zdgjP9S6EbAKoxnqIKAE="; 28 - }; 29 - }; 9 + # Per-platform wheels; versions can differ because upstream stopped shipping 10 + # macOS wheels after 0.3.44. Maintained by ./update.sh. 11 + wheels = lib.importJSON ./wheels.json; 30 12 31 13 wheel = 32 14 wheels.${stdenv.hostPlatform.system} ··· 34 16 in 35 17 python3Packages.buildPythonPackage { 36 18 pname = "vosk"; 37 - inherit version; 19 + inherit (wheel) version; 38 20 format = "wheel"; 39 21 40 22 src = fetchurl { 41 - inherit (wheel) url hash; 23 + url = "https://files.pythonhosted.org/packages/py3/v/vosk/vosk-${wheel.version}-py3-none-${wheel.tag}.whl"; 24 + inherit (wheel) hash; 42 25 }; 43 26 44 - nativeBuildInputs = [ autoPatchelfHook ]; 27 + # Only the Linux wheels ship ELF libraries; the macOS one is Mach-O. 28 + nativeBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [ autoPatchelfHook ]; 45 29 46 - buildInputs = [ stdenv.cc.cc.lib ]; 30 + buildInputs = lib.optionals stdenv.hostPlatform.isLinux [ stdenv.cc.cc.lib ]; 47 31 48 32 dependencies = with python3Packages; [ 49 33 cffi ··· 57 41 doCheck = false; 58 42 59 43 pythonImportsCheck = [ "vosk" ]; 44 + 45 + passthru.updateScript = ./update.sh; 60 46 61 47 meta = { 62 48 description = "Offline speech recognition API based on Kaldi and Vosk";
+43
pkgs/vosk/update.sh
··· 1 + #!/usr/bin/env bash 2 + set -euo pipefail 3 + 4 + # Upstream publishes a different set of platform wheels per release (no macOS 5 + # wheel since 0.3.45), so each platform in wheels.json tracks the newest PyPI 6 + # release that still ships its wheel tag. Hashes come from PyPI's sha256 7 + # digests; a final build verifies the result. 8 + # Run by update-pkgs from the flake root ($0 is a read-only store copy). 9 + attr=vosk 10 + json=pkgs/vosk/wheels.json 11 + system=$(nix eval --raw --impure --expr 'builtins.currentSystem') 12 + 13 + pypi=$(curl -fsSL https://pypi.org/pypi/vosk/json) 14 + 15 + new=$(jq -c . "$json") 16 + for platform in $(jq -r 'keys[]' "$json"); do 17 + tag=$(jq -r --arg p "$platform" '.[$p].tag' "$json") 18 + # Newest non-yanked release providing vosk-<v>-py3-none-<tag>.whl. 19 + match=$(jq -r --arg tag "$tag" ' 20 + .releases | to_entries[] 21 + | .key as $v 22 + | .value[] 23 + | select(.yanked | not) 24 + | select(.filename == "vosk-\($v)-py3-none-\($tag).whl") 25 + | "\($v) \(.digests.sha256)"' <<<"$pypi" | sort -V -k1,1 | tail -n1) 26 + if [ -z "$match" ]; then 27 + echo "$attr: no wheel for $platform ($tag) on PyPI" >&2 28 + exit 1 29 + fi 30 + version=${match%% *} 31 + hash=$(nix hash convert --hash-algo sha256 --to sri "${match##* }") 32 + new=$(jq -c --arg p "$platform" --arg v "$version" --arg h "$hash" \ 33 + '.[$p].version = $v | .[$p].hash = $h' <<<"$new") 34 + done 35 + 36 + if [ "$(jq -S . <<<"$new")" = "$(jq -S . "$json")" ]; then 37 + echo "$attr: already up to date ($(jq -r '[.[].version] | unique | join(", ")' "$json"))" 38 + exit 0 39 + fi 40 + 41 + jq . <<<"$new" >"$json" 42 + echo "$attr: updated to $(jq -r 'to_entries | map("\(.key)=\(.value.version)") | join(", ")' "$json")" 43 + nix build --no-link ".#packages.$system.$attr"
+22
pkgs/vosk/wheels.json
··· 1 + { 2 + "x86_64-linux": { 3 + "version": "0.3.45", 4 + "tag": "manylinux_2_12_x86_64.manylinux2010_x86_64", 5 + "hash": "sha256-JeAlCTxDmdcnj1Q1aO2MxUYKw6S/SMI2c6zh4l0mYZ8=" 6 + }, 7 + "aarch64-linux": { 8 + "version": "0.3.45", 9 + "tag": "manylinux2014_aarch64", 10 + "hash": "sha256-VO+0fdiQ5UTp4g8DFkE6zsf4aA0E7AlcYUCrTnAmJwQ=" 11 + }, 12 + "x86_64-darwin": { 13 + "version": "0.3.44", 14 + "tag": "macosx_10_6_universal2", 15 + "hash": "sha256-Ap0LPWpc/4dMV1uKWBSkzM+zdgjP9S6EbAKoxnqIKAE=" 16 + }, 17 + "aarch64-darwin": { 18 + "version": "0.3.44", 19 + "tag": "macosx_10_6_universal2", 20 + "hash": "sha256-Ap0LPWpc/4dMV1uKWBSkzM+zdgjP9S6EbAKoxnqIKAE=" 21 + } 22 + }