diff --git a/pkgs/tools/audio/wyoming/piper-entrypoint.patch b/pkgs/tools/audio/wyoming/piper-entrypoint.patch new file mode 100644 index 000000000000..c2e4245e5b25 --- /dev/null +++ b/pkgs/tools/audio/wyoming/piper-entrypoint.patch @@ -0,0 +1,30 @@ +diff --git a/setup.py b/setup.py +index 1355313..3b144c1 100644 +--- a/setup.py ++++ b/setup.py +@@ -35,4 +35,9 @@ setup( + "Programming Language :: Python :: 3.10", + ], + keywords="rhasspy wyoming piper", ++ entry_points={ ++ 'console_scripts': [ ++ 'wyoming-piper = wyoming_piper:__main__.run' ++ ] ++ } + ) +diff --git a/wyoming_piper/__main__.py b/wyoming_piper/__main__.py +index f60cf13..a0a15f7 100755 +--- a/wyoming_piper/__main__.py ++++ b/wyoming_piper/__main__.py +@@ -143,5 +143,9 @@ async def main() -> None: + + # ----------------------------------------------------------------------------- + +-if __name__ == "__main__": ++def run(): + asyncio.run(main()) ++ ++ ++if __name__ == "__main__": ++ run() +\ No newline at end of file diff --git a/pkgs/tools/audio/wyoming/piper.nix b/pkgs/tools/audio/wyoming/piper.nix new file mode 100644 index 000000000000..830f72059653 --- /dev/null +++ b/pkgs/tools/audio/wyoming/piper.nix @@ -0,0 +1,37 @@ +{ lib +, python3 +, fetchPypi +}: + +python3.pkgs.buildPythonApplication rec { + pname = "wyoming-piper"; + version = "0.0.3"; + format = "setuptools"; + + src = fetchPypi { + pname = "wyoming_piper"; + inherit version; + hash = "sha256-vl7LjW/2HBx6o/+vpap+wSG3XXzDwFacNmcbeU/8bOs="; + }; + + patches = [ + ./piper-entrypoint.patch + ]; + + propagatedBuildInputs = with python3.pkgs; [ + wyoming + ]; + + pythonImportsCheck = [ + "wyoming_piper" + ]; + + doCheck = false; + + meta = with lib; { + description = "Wyoming Server for Piper"; + homepage = "https://pypi.org/project/wyoming-piper/"; + license = licenses.mit; + maintainers = with maintainers; [ hexa ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index adea606aa109..befc154ae6e7 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -36199,6 +36199,8 @@ with pkgs; tts = callPackage ../tools/audio/tts { }; + wyoming-piper = callPackage ../tools/audio/wyoming/piper.nix { }; + ### GAMES _1oom = callPackage ../games/1oom { };