Files
nixpkgs/pkgs/development/python-modules/kaldi-active-grammar/default.nix
T
Ihar Hrachyshka 567e8dfd8e treewide: clean up 'meta = with' pattern
This commit was created by a combination of scripts and tools:
- an ast-grep script to prefix things in meta with `lib.`,
- a modified nixf-diagnose / nixf combination to remove unused `with
lib;`, and
- regular nixfmt.

Co-authored-by: Wolfgang Walther <walther@technowledgy.de>
2025-12-10 18:09:49 +01:00

83 lines
1.6 KiB
Nix

{
lib,
buildPythonPackage,
fetchFromGitHub,
scikit-build,
cmake,
ush,
requests,
six,
numpy,
cffi,
openfst,
replaceVars,
callPackage,
}:
#
# Maintainer note: only in-tree dependant is `dragonfly`, try to
# update the two alongside eachother.
#
let
kaldi = callPackage ./fork.nix { };
in
buildPythonPackage rec {
pname = "kaldi-active-grammar";
version = "3.1.0";
format = "setuptools";
src = fetchFromGitHub {
owner = "daanzu";
repo = "kaldi-active-grammar";
rev = "v${version}";
sha256 = "0lilk6yjzcy31avy2z36bl9lr60gzwhmyqwqn8akq11qc3mbffsk";
};
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
(replaceVars ./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
];
propagatedBuildInputs = [
ush
requests
numpy
cffi
six
];
doCheck = false; # no tests exist
meta = {
description = "Python Kaldi speech recognition";
homepage = "https://github.com/daanzu/kaldi-active-grammar";
license = lib.licenses.agpl3Plus;
maintainers = [ ];
# Other platforms are supported upstream.
platforms = lib.platforms.linux;
};
}