diff options
author | Alyssa Ross <hi@alyssa.is> | 2023-08-08 16:04:42 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2023-08-13 06:35:37 +0000 |
commit | 12aaa58dac35800b5b7d77f81cf2a87c21ee55da (patch) | |
tree | be0add9e5c22a85d20b5d78206aa74f956eb2a1b /nixpkgs/pkgs/tools/audio/piper | |
parent | 45892a5591202f75a1c2f1ca7c62a92c7566e3c5 (diff) | |
parent | 5a8e9243812ba528000995b294292d3b5e120947 (diff) | |
download | nixlib-12aaa58dac35800b5b7d77f81cf2a87c21ee55da.tar nixlib-12aaa58dac35800b5b7d77f81cf2a87c21ee55da.tar.gz nixlib-12aaa58dac35800b5b7d77f81cf2a87c21ee55da.tar.bz2 nixlib-12aaa58dac35800b5b7d77f81cf2a87c21ee55da.tar.lz nixlib-12aaa58dac35800b5b7d77f81cf2a87c21ee55da.tar.xz nixlib-12aaa58dac35800b5b7d77f81cf2a87c21ee55da.tar.zst nixlib-12aaa58dac35800b5b7d77f81cf2a87c21ee55da.zip |
Merge branch 'nixos-unstable' of https://github.com/NixOS/nixpkgs
Conflicts: nixpkgs/pkgs/applications/window-managers/sway/default.nix nixpkgs/pkgs/build-support/go/module.nix nixpkgs/pkgs/build-support/rust/build-rust-package/default.nix nixpkgs/pkgs/development/libraries/mesa/default.nix nixpkgs/pkgs/servers/dict/dictd-db.nix Link: https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/-/issues/391
Diffstat (limited to 'nixpkgs/pkgs/tools/audio/piper')
-rw-r--r-- | nixpkgs/pkgs/tools/audio/piper/default.nix | 69 | ||||
-rw-r--r-- | nixpkgs/pkgs/tools/audio/piper/fix-compilation-with-newer-onnxruntime.patch | 18 | ||||
-rw-r--r-- | nixpkgs/pkgs/tools/audio/piper/train.nix | 54 |
3 files changed, 141 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/tools/audio/piper/default.nix b/nixpkgs/pkgs/tools/audio/piper/default.nix new file mode 100644 index 000000000000..d753d7bb3e1e --- /dev/null +++ b/nixpkgs/pkgs/tools/audio/piper/default.nix @@ -0,0 +1,69 @@ +{ lib +, stdenv +, fetchFromGitHub + +# build time +, cmake +, pkg-config + +# runtime +, onnxruntime +, pcaudiolib +, piper-phonemize +, spdlog + +# tests +, piper-train +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "piper"; + version = "1.2.0"; + + src = fetchFromGitHub { + owner = "rhasspy"; + repo = "piper"; + rev = "refs/tags/v${finalAttrs.version}"; + hash = "sha256-6WNWqJt0PO86vnf+3iHaRRg2KwBOEj4aicmB+P2phlk="; + }; + + sourceRoot = "${finalAttrs.src.name}/src/cpp"; + + nativeBuildInputs = [ + cmake + pkg-config + ]; + + 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 = "A fast, local neural text to speech system"; + homepage = "https://github.com/rhasspy/piper"; + license = licenses.mit; + maintainers = with maintainers; [ hexa ]; + }; +}) diff --git a/nixpkgs/pkgs/tools/audio/piper/fix-compilation-with-newer-onnxruntime.patch b/nixpkgs/pkgs/tools/audio/piper/fix-compilation-with-newer-onnxruntime.patch new file mode 100644 index 000000000000..9d2e46bb4e91 --- /dev/null +++ b/nixpkgs/pkgs/tools/audio/piper/fix-compilation-with-newer-onnxruntime.patch @@ -0,0 +1,18 @@ +diff --git a/src/cpp/synthesize.hpp b/src/cpp/synthesize.hpp +index ef61aef..4c7db7a 100644 +--- a/synthesize.hpp ++++ b/synthesize.hpp +@@ -119,11 +119,11 @@ void synthesize(SynthesisConfig &synthesisConfig, ModelSession &session, + + // Clean up + for (size_t i = 0; i < outputTensors.size(); i++) { +- Ort::OrtRelease(outputTensors[i].release()); ++ Ort::detail::OrtRelease(outputTensors[i].release()); + } + + for (size_t i = 0; i < inputTensors.size(); i++) { +- Ort::OrtRelease(inputTensors[i].release()); ++ Ort::detail::OrtRelease(inputTensors[i].release()); + } + } + } // namespace larynx diff --git a/nixpkgs/pkgs/tools/audio/piper/train.nix b/nixpkgs/pkgs/tools/audio/piper/train.nix new file mode 100644 index 000000000000..2cab1ba4ba04 --- /dev/null +++ b/nixpkgs/pkgs/tools/audio/piper/train.nix @@ -0,0 +1,54 @@ +{ piper-tts +, python3 +}: + +let + python = python3.override { + packageOverrides = self: super: { + }; + }; +in + +python.pkgs.buildPythonPackage { + inherit (piper-tts) version src; + + pname = "piper-train"; + format = "setuptools"; + + sourceRoot = "${piper-tts.src.name}/src/python"; + + nativeBuildInputs = with python.pkgs; [ + cython + ]; + + postBuild = '' + make -C piper_train/vits/monotonic_align + ''; + + postInstall = '' + export MONOTONIC_ALIGN=$out/${python.sitePackages}/piper_train/vits/monotonic_align/monotonic_align + mkdir -p $MONOTONIC_ALIGN + cp -v ./piper_train/vits/monotonic_align/piper_train/vits/monotonic_align/core.*.so $MONOTONIC_ALIGN/ + ''; + + propagatedBuildInputs = with python.pkgs; [ + espeak-phonemizer + librosa + numpy + onnxruntime + piper-phonemize + pytorch-lightning + torch + ]; + + pythonImportsCheck = [ + "piper_train" + ]; + + doCheck = false; # no tests + + meta = piper-tts.meta // { + # requires torch<2, pytorch-lightning~=1.7 + broken = true; + }; +} |