1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 scikit-build, 6 cmake, 7 ush, 8 requests, 9 six, 10 numpy, 11 cffi, 12 openfst, 13 replaceVars, 14 callPackage, 15}: 16 17# 18# Maintainer note: only in-tree dependant is `dragonfly`, try to 19# update the two alongside eachother. 20# 21 22let 23 kaldi = callPackage ./fork.nix { }; 24in 25buildPythonPackage rec { 26 pname = "kaldi-active-grammar"; 27 version = "3.1.0"; 28 format = "setuptools"; 29 30 src = fetchFromGitHub { 31 owner = "daanzu"; 32 repo = "kaldi-active-grammar"; 33 rev = "v${version}"; 34 sha256 = "0lilk6yjzcy31avy2z36bl9lr60gzwhmyqwqn8akq11qc3mbffsk"; 35 }; 36 37 KALDI_BRANCH = "foo"; 38 KALDIAG_SETUP_RAW = "1"; 39 40 patches = [ 41 # Makes sure scikit-build doesn't try to build the dependencies for us 42 ./0001-stub.patch 43 # Uses the dependencies' binaries from $PATH instead of a specific directory 44 ./0002-exec-path.patch 45 # Makes it dynamically link to the correct Kaldi library 46 (replaceVars ./0003-ffi-path.patch { 47 kaldiFork = "${kaldi}/lib"; 48 }) 49 ]; 50 51 # scikit-build puts us in the wrong folder. That is bad. 52 preBuild = '' 53 cd .. 54 ''; 55 56 buildInputs = [ 57 openfst 58 kaldi 59 ]; 60 nativeBuildInputs = [ 61 scikit-build 62 cmake 63 ]; 64 propagatedBuildInputs = [ 65 ush 66 requests 67 numpy 68 cffi 69 six 70 ]; 71 72 doCheck = false; # no tests exist 73 74 meta = with lib; { 75 description = "Python Kaldi speech recognition"; 76 homepage = "https://github.com/daanzu/kaldi-active-grammar"; 77 license = licenses.agpl3Plus; 78 maintainers = [ ]; 79 # Other platforms are supported upstream. 80 platforms = platforms.linux; 81 }; 82}