Skip to content

Commit

Permalink
feat(nix): fetch model files
Browse files Browse the repository at this point in the history
  • Loading branch information
Bear-03 committed Oct 24, 2024
1 parent 9b35fba commit fcaf34e
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion nix/shells/default/default.nix
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
{ pkgs, lib, ... }:
let
# Libs are needed to run the examples
# Libs and model files are needed to run the examples for testing purposes
voskVersion = "0.3.45";
arch = builtins.elemAt (lib.strings.splitString "-" pkgs.system) 0;
voskLib = pkgs.fetchzip {
url = "https://github.com/alphacep/vosk-api/releases/download/v${voskVersion}/vosk-linux-${arch}-${voskVersion}.zip";
hash = "sha256-ToMDbD5ooFMHU0nNlfpLynF29kkfMknBluKO5PipLFY=";
};
model = pkgs.fetchzip {
url = "https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip";
hash = "sha256-CIoPZ/krX+UW2w7c84W3oc1n4zc9BBS/fc8rVYUthuY=";
};
speakerModel = pkgs.fetchzip {
url = "https://alphacephei.com/vosk/models/vosk-model-spk-0.4.zip";
hash = "sha256-wpTfZnEL1sCfpLhp+l62d8GcOinR15XnSHaLVASH4RA=";
};
in
pkgs.mkShell {
buildInputs = with pkgs; [
Expand All @@ -22,4 +30,8 @@ pkgs.mkShell {
pkgs.stdenv.cc.cc
voskLib
];

# Run the examples like "cargo run --example <example> $MODEL $SPEAKER_MODEL" etc.
MODEL = model;
SPEAKER_MODEL = speakerModel;
}

0 comments on commit fcaf34e

Please sign in to comment.