From 41917143e6d17563c72c10f753d1350a580d61f1 Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Sat, 8 Jun 2024 12:17:14 +0200 Subject: [PATCH] whisper-ctranslate2: support speaker diarization Includes some drive-by cleanup: - Use PEP517 build process - Add missing pre/post hooks in checkPhase (cherry picked from commit 9a882b22885d71d3c7a43554896335752afa2274) --- .../audio/whisper-ctranslate2/default.nix | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/pkgs/tools/audio/whisper-ctranslate2/default.nix b/pkgs/tools/audio/whisper-ctranslate2/default.nix index 4b9602fefa0c..0921bd6a3d0a 100644 --- a/pkgs/tools/audio/whisper-ctranslate2/default.nix +++ b/pkgs/tools/audio/whisper-ctranslate2/default.nix @@ -9,7 +9,7 @@ let in python3.pkgs.buildPythonApplication { inherit pname version; - format = "setuptools"; + pyproject = true; disabled = python3.pythonOlder "3.6"; @@ -20,25 +20,30 @@ python3.pkgs.buildPythonApplication { hash = "sha256-39kVo4+ZEyjhWbLjw8acW2vJxa3fbQ/tPgnZH3USsYY="; }; - propagatedBuildInputs = with python3.pkgs; [ - numpy - faster-whisper - ctranslate2 - tqdm - sounddevice - ]; + build-system = [ python3.pkgs.setuptools ]; - passthru.updateScript = nix-update-script { }; + dependencies = with python3.pkgs; [ + ctranslate2 + faster-whisper + numpy + pyannote-audio + sounddevice + tqdm + ]; nativeCheckInputs = with python3.pkgs; [ nose2 ]; checkPhase = '' + runHook preCheck # Note: we are not running the `e2e-tests` because they require downloading models from the internet. ${python3.interpreter} -m nose2 -s tests + runHook postCheck ''; + passthru.updateScript = nix-update-script { }; + meta = with lib; { description = "Whisper command line client compatible with original OpenAI client based on CTranslate2"; homepage = "https://github.com/Softcatala/whisper-ctranslate2";