forked from
lass.pds.lassul.us/superconfig
This repository has no description
1.4 kB
53 lines
1{
2 lib,
3 python3Packages,
4 fetchurl,
5 stdenv,
6 autoPatchelfHook,
7}:
8let
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;
12
13 wheel =
14 wheels.${stdenv.hostPlatform.system}
15 or (throw "Unsupported platform: ${stdenv.hostPlatform.system}");
16in
17python3Packages.buildPythonPackage {
18 pname = "vosk";
19 inherit (wheel) version;
20 format = "wheel";
21
22 src = fetchurl {
23 url = "https://files.pythonhosted.org/packages/py3/v/vosk/vosk-${wheel.version}-py3-none-${wheel.tag}.whl";
24 inherit (wheel) hash;
25 };
26
27 # Only the Linux wheels ship ELF libraries; the macOS one is Mach-O.
28 nativeBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [ autoPatchelfHook ];
29
30 buildInputs = lib.optionals stdenv.hostPlatform.isLinux [ stdenv.cc.cc.lib ];
31
32 dependencies = with python3Packages; [
33 cffi
34 requests
35 tqdm
36 srt
37 websockets
38 ];
39
40 # Skip tests as they require audio files and models
41 doCheck = false;
42
43 pythonImportsCheck = [ "vosk" ];
44
45 passthru.updateScript = ./update.sh;
46
47 meta = {
48 description = "Offline speech recognition API based on Kaldi and Vosk";
49 homepage = "https://alphacephei.com/vosk/";
50 license = lib.licenses.asl20;
51 platforms = lib.attrNames wheels;
52 };
53}