From 99cfc03f72efe65b07a1ce1dd548d05fc202a91a Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Wed, 27 May 2026 21:52:09 +0000 Subject: [PATCH] python3Packages.speechrecognition: cleanup, fix on darwin --- .../speechrecognition/default.nix | 56 +++++++++++++------ 1 file changed, 38 insertions(+), 18 deletions(-) diff --git a/pkgs/development/python-modules/speechrecognition/default.nix b/pkgs/development/python-modules/speechrecognition/default.nix index 5b4fa1d28b36..cb82eeea2a30 100644 --- a/pkgs/development/python-modules/speechrecognition/default.nix +++ b/pkgs/development/python-modules/speechrecognition/default.nix @@ -2,31 +2,49 @@ lib, buildPythonPackage, fetchFromGitHub, - cacert, - cohere, - faster-whisper, + flac, - google-cloud-speech, - groq, - httpx, - openai-whisper, - openai, - pocketsphinx, - pyaudio, - pytest-httpserver, - pytestCheckHook, - requests, - respx, + + # build-system setuptools, - soundfile, + + # dependencies standard-aifc, typing-extensions, + + # optional-dependencies + # assemblyai + requests, + # audio + pyaudio, + # cohere + cohere, + # faster-whisper + faster-whisper, + # google-cloud + google-cloud-speech, + # grok + groq, + httpx, + # openai + openai, + # pocketsphinx + pocketsphinx, + # whisper-local + openai-whisper, + soundfile, + + # tests + pytest-httpserver, + pytestCheckHook, + respx, }: buildPythonPackage (finalAttrs: { pname = "speechrecognition"; version = "3.16.1"; pyproject = true; + __structuredAttrs = true; src = fetchFromGitHub { owner = "Uberi"; @@ -35,8 +53,8 @@ buildPythonPackage (finalAttrs: { hash = "sha256-5BTwUzo2U7/VwmEqldxXddt/ByKebZKY1KhCEoIb9F8="; }; + # Remove Bundled binaries postPatch = '' - # Remove Bundled binaries rm speech_recognition/flac-* rm -r third-party @@ -75,12 +93,12 @@ buildPythonPackage (finalAttrs: { nativeCheckInputs = [ groq + pocketsphinx pytest-httpserver pytestCheckHook - pocketsphinx respx ] - ++ lib.flatten (builtins.attrValues finalAttrs.passthru.optional-dependencies); + ++ lib.concatAttrValues finalAttrs.passthru.optional-dependencies; pythonImportsCheck = [ "speech_recognition" ]; @@ -94,6 +112,8 @@ buildPythonPackage (finalAttrs: { "tests/recognizers/test_vosk.py" ]; + __darwinAllowLocalNetworking = true; + meta = { description = "Speech recognition module for Python, supporting several engines and APIs, online and offline"; homepage = "https://github.com/Uberi/speech_recognition";