nixpkgs/pkgs/tools/audio/piper/default.nix

76 lines
1.3 KiB
Nix
Raw Normal View History

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