2021-10-17 02:12:59 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
|
|
|
, scikit-build
|
|
|
|
, cmake
|
|
|
|
, ush
|
|
|
|
, requests
|
2022-04-27 09:35:20 +00:00
|
|
|
, six
|
2021-10-17 02:12:59 +00:00
|
|
|
, numpy
|
|
|
|
, cffi
|
|
|
|
, openfst
|
|
|
|
, substituteAll
|
|
|
|
, callPackage
|
|
|
|
}:
|
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
#
|
|
|
|
# Maintainer note: only in-tree dependant is `dragonfly`, try to
|
|
|
|
# update the two alongside eachother.
|
|
|
|
#
|
|
|
|
|
2021-10-17 02:12:59 +00:00
|
|
|
let
|
|
|
|
kaldi = callPackage ./fork.nix { };
|
|
|
|
in
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "kaldi-active-grammar";
|
2022-02-10 20:34:41 +00:00
|
|
|
version = "3.1.0";
|
2024-01-02 11:29:13 +00:00
|
|
|
format = "setuptools";
|
2021-10-17 02:12:59 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "daanzu";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2022-02-10 20:34:41 +00:00
|
|
|
sha256 = "0lilk6yjzcy31avy2z36bl9lr60gzwhmyqwqn8akq11qc3mbffsk";
|
2021-10-17 02:12:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
KALDI_BRANCH = "foo";
|
|
|
|
KALDIAG_SETUP_RAW = "1";
|
|
|
|
|
|
|
|
patches = [
|
|
|
|
# Makes sure scikit-build doesn't try to build the dependencies for us
|
|
|
|
./0001-stub.patch
|
|
|
|
# Uses the dependencies' binaries from $PATH instead of a specific directory
|
|
|
|
./0002-exec-path.patch
|
|
|
|
# Makes it dynamically link to the correct Kaldi library
|
|
|
|
(substituteAll {
|
|
|
|
src = ./0003-ffi-path.patch;
|
|
|
|
kaldiFork = "${kaldi}/lib";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
|
|
|
# scikit-build puts us in the wrong folder. That is bad.
|
|
|
|
preBuild = ''
|
|
|
|
cd ..
|
|
|
|
'';
|
|
|
|
|
|
|
|
buildInputs = [ openfst kaldi ];
|
|
|
|
nativeBuildInputs = [ scikit-build cmake ];
|
2022-04-27 09:35:20 +00:00
|
|
|
propagatedBuildInputs = [ ush requests numpy cffi six ];
|
2021-10-17 02:12:59 +00:00
|
|
|
|
2022-03-05 16:20:37 +00:00
|
|
|
doCheck = false; # no tests exist
|
|
|
|
|
2021-10-17 02:12:59 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Python Kaldi speech recognition";
|
|
|
|
homepage = "https://github.com/daanzu/kaldi-active-grammar";
|
|
|
|
license = licenses.agpl3Plus;
|
|
|
|
maintainers = with maintainers; [ ckie ];
|
|
|
|
# Other platforms are supported upstream.
|
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|