depot/pkgs/tools/audio/piper/default.nix
Luke Granger-Brown 57725ef3ec Squashed 'third_party/nixpkgs/' content from commit 76612b17c0ce
git-subtree-dir: third_party/nixpkgs
git-subtree-split: 76612b17c0ce71689921ca12d9ffdc9c23ce40b2
2024-11-10 23:59:47 +00:00

75 lines
1.3 KiB
Nix

{ lib
, stdenv
, fetchFromGitHub
# build time
, cmake
, pkg-config
# runtime
, fmt
, onnxruntime
, pcaudiolib
, piper-phonemize
, spdlog
# tests
, piper-train
}:
stdenv.mkDerivation (finalAttrs: {
pname = "piper";
version = "2023.11.14-2";
src = fetchFromGitHub {
owner = "rhasspy";
repo = "piper";
rev = "refs/tags/${finalAttrs.version}";
hash = "sha256-3ynWyNcdf1ffU3VoDqrEMrm5Jo5Zc5YJcVqwLreRCsI=";
};
nativeBuildInputs = [
cmake
pkg-config
];
cmakeFlags = [
"-DFMT_DIR=${fmt}"
"-DSPDLOG_DIR=${spdlog.src}"
"-DPIPER_PHONEMIZE_DIR=${piper-phonemize}"
];
buildInputs = [
onnxruntime
pcaudiolib
piper-phonemize
piper-phonemize.espeak-ng
spdlog
];
env.NIX_CFLAGS_COMPILE = builtins.toString [
"-isystem ${lib.getDev piper-phonemize}/include/piper-phonemize"
];
installPhase = ''
runHook preInstall
mkdir -p $out/bin
install -m 0755 piper $out/bin
runHook postInstall
'';
passthru.tests = {
inherit piper-train;
};
meta = with lib; {
changelog = "https://github.com/rhasspy/piper/releases/tag/v${finalAttrs.version}";
description = "Fast, local neural text to speech system";
homepage = "https://github.com/rhasspy/piper";
license = licenses.mit;
maintainers = with maintainers; [ hexa ];
mainProgram = "piper";
};
})