Loading pkgs/development/python-modules/misaki/default.nix 0 → 100644 +118 −0 Original line number Diff line number Diff line { addict, buildPythonPackage, espeak-ng, fetchFromGitHub, fetchpatch2, fugashi, hatchling, jaconv, jamo, jieba, lib, nltk, num2words, ordered-set, phonemizer, pip, pypinyin, pythonOlder, regex, replaceVars, spacy-curated-transformers, spacy, pytestCheckHook, stdenv, torch, transformers, unidic, }: buildPythonPackage { pname = "misaki"; version = "0-unstable-2025-06-16"; pyproject = true; src = fetchFromGitHub { owner = "hexgrad"; repo = "misaki"; rev = "49ddead831fc1a46beab3f9cb6064d93fd3f6347"; hash = "sha256-XkmCG0Vkw/iyLNmwhaW5gp6sg8ieHFeK6fBJ3Jb+J8Q="; }; patches = [ (fetchpatch2 { name = "pr82-remove-pip-dependency.patch"; url = "https://github.com/hexgrad/misaki/commit/7d2fdff9fe046dd52b638bbb1b243fb789f4cb31.patch?full_index=1"; hash = "sha256-N796YWrGe51FYVdxbQ8omJxeGdvOAiKEUKhhm10TQO8="; }) (replaceVars ./set-espeak-paths.patch { espeak-library-path = "${lib.getLib espeak-ng}/lib/libespeak-ng${stdenv.hostPlatform.extensions.sharedLibrary}"; espeak-data-path = "${lib.getLib espeak-ng}/share/espeak-ng-data"; }) ]; build-system = [ hatchling ]; dependencies = [ addict regex ]; # See https://github.com/hexgrad/misaki/blob/main/pyproject.toml#L26 passthru.optional-dependencies = { en = [ num2words spacy spacy-curated-transformers phonemizer # phonemizer-fork -- we already patch phonemizer in nixpkgs, no need for the "-fork" version # espeakng-loader -- ./set-espeak-paths.patch obviates the need for this torch transformers ]; ja = [ fugashi jaconv # mojimoji -- not packaged as of 2025-06-16 unidic # pyopenjtalk -- not packaged as of 2025-06-16 ]; ko = [ jamo nltk ]; zh = [ jieba ordered-set pypinyin # cn2an -- not packaged as of 2025-06-16 # pypinyin-dict -- not packaged as of 2025-06-16 ]; vi = [ num2words spacy spacy-curated-transformers # underthesea -- not packaged as of 2025-06-16 ]; # he = [ mishkal-hebrew ]; -- not packaged as of 2025-06-16 }; # Package does not have tests as of 2025-06-16, but phonemizer is required for # pythonImportsCheck. nativeCheckInputs = [ phonemizer ]; pythonImportsCheck = [ "misaki" "misaki.espeak" ]; meta = { description = "G2P engine for TTS"; homepage = "https://github.com/hexgrad/misaki"; license = lib.licenses.asl20; maintainers = with lib.maintainers; [ samuela ]; }; } pkgs/development/python-modules/misaki/set-espeak-paths.patch 0 → 100644 +20 −0 Original line number Diff line number Diff line diff --git a/misaki/espeak.py b/misaki/espeak.py index e5d880c..42c2596 100644 --- a/misaki/espeak.py +++ b/misaki/espeak.py @@ -1,13 +1,12 @@ from phonemizer.backend.espeak.wrapper import EspeakWrapper from typing import Tuple -import espeakng_loader import phonemizer import re # Set espeak-ng library path and espeak-ng-data -EspeakWrapper.set_library(espeakng_loader.get_library_path()) +EspeakWrapper.set_library("@espeak-library-path@") # Change data_path as needed when editing espeak-ng phonemes -EspeakWrapper.set_data_path(espeakng_loader.get_data_path()) +EspeakWrapper.set_data_path("@espeak-data-path@") # EspeakFallback is used as a last resort for English class EspeakFallback: pkgs/development/python-modules/phonemizer/default.nix +8 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ replaceVars, buildPythonPackage, fetchPypi, fetchpatch2, joblib, segments, attrs, Loading Loading @@ -31,6 +32,13 @@ buildPythonPackage rec { libespeak = "${lib.getLib espeak-ng}/lib/libespeak-ng${stdenv.hostPlatform.extensions.sharedLibrary}"; # FIXME package festival }) # This patch is needed for python3Packages.misaki. See https://github.com/thewh1teagle/espeakng-loader?tab=readme-ov-file#usage-with-phonemizer # and https://github.com/bootphon/phonemizer/pull/191. (fetchpatch2 { name = "pr191-add-option-to-use-custom-espeak-data-path.patch"; url = "https://github.com/bootphon/phonemizer/commit/cc1db4bfaf688fdfb8275fd83d218f06411455e6.patch?full_index=1"; hash = "sha256-PMeX7A9BBVLS3Sk/Lum85GpJzKXM5tULTWSURq3MD8E="; }) ]; propagatedBuildInputs = [ Loading pkgs/top-level/python-packages.nix +2 −0 Original line number Diff line number Diff line Loading @@ -9080,6 +9080,8 @@ self: super: with self; { misaka = callPackage ../development/python-modules/misaka { }; misaki = callPackage ../development/python-modules/misaki { }; misoc = callPackage ../development/python-modules/misoc { }; miss-hit = callPackage ../development/python-modules/miss-hit { }; Loading Loading
pkgs/development/python-modules/misaki/default.nix 0 → 100644 +118 −0 Original line number Diff line number Diff line { addict, buildPythonPackage, espeak-ng, fetchFromGitHub, fetchpatch2, fugashi, hatchling, jaconv, jamo, jieba, lib, nltk, num2words, ordered-set, phonemizer, pip, pypinyin, pythonOlder, regex, replaceVars, spacy-curated-transformers, spacy, pytestCheckHook, stdenv, torch, transformers, unidic, }: buildPythonPackage { pname = "misaki"; version = "0-unstable-2025-06-16"; pyproject = true; src = fetchFromGitHub { owner = "hexgrad"; repo = "misaki"; rev = "49ddead831fc1a46beab3f9cb6064d93fd3f6347"; hash = "sha256-XkmCG0Vkw/iyLNmwhaW5gp6sg8ieHFeK6fBJ3Jb+J8Q="; }; patches = [ (fetchpatch2 { name = "pr82-remove-pip-dependency.patch"; url = "https://github.com/hexgrad/misaki/commit/7d2fdff9fe046dd52b638bbb1b243fb789f4cb31.patch?full_index=1"; hash = "sha256-N796YWrGe51FYVdxbQ8omJxeGdvOAiKEUKhhm10TQO8="; }) (replaceVars ./set-espeak-paths.patch { espeak-library-path = "${lib.getLib espeak-ng}/lib/libespeak-ng${stdenv.hostPlatform.extensions.sharedLibrary}"; espeak-data-path = "${lib.getLib espeak-ng}/share/espeak-ng-data"; }) ]; build-system = [ hatchling ]; dependencies = [ addict regex ]; # See https://github.com/hexgrad/misaki/blob/main/pyproject.toml#L26 passthru.optional-dependencies = { en = [ num2words spacy spacy-curated-transformers phonemizer # phonemizer-fork -- we already patch phonemizer in nixpkgs, no need for the "-fork" version # espeakng-loader -- ./set-espeak-paths.patch obviates the need for this torch transformers ]; ja = [ fugashi jaconv # mojimoji -- not packaged as of 2025-06-16 unidic # pyopenjtalk -- not packaged as of 2025-06-16 ]; ko = [ jamo nltk ]; zh = [ jieba ordered-set pypinyin # cn2an -- not packaged as of 2025-06-16 # pypinyin-dict -- not packaged as of 2025-06-16 ]; vi = [ num2words spacy spacy-curated-transformers # underthesea -- not packaged as of 2025-06-16 ]; # he = [ mishkal-hebrew ]; -- not packaged as of 2025-06-16 }; # Package does not have tests as of 2025-06-16, but phonemizer is required for # pythonImportsCheck. nativeCheckInputs = [ phonemizer ]; pythonImportsCheck = [ "misaki" "misaki.espeak" ]; meta = { description = "G2P engine for TTS"; homepage = "https://github.com/hexgrad/misaki"; license = lib.licenses.asl20; maintainers = with lib.maintainers; [ samuela ]; }; }
pkgs/development/python-modules/misaki/set-espeak-paths.patch 0 → 100644 +20 −0 Original line number Diff line number Diff line diff --git a/misaki/espeak.py b/misaki/espeak.py index e5d880c..42c2596 100644 --- a/misaki/espeak.py +++ b/misaki/espeak.py @@ -1,13 +1,12 @@ from phonemizer.backend.espeak.wrapper import EspeakWrapper from typing import Tuple -import espeakng_loader import phonemizer import re # Set espeak-ng library path and espeak-ng-data -EspeakWrapper.set_library(espeakng_loader.get_library_path()) +EspeakWrapper.set_library("@espeak-library-path@") # Change data_path as needed when editing espeak-ng phonemes -EspeakWrapper.set_data_path(espeakng_loader.get_data_path()) +EspeakWrapper.set_data_path("@espeak-data-path@") # EspeakFallback is used as a last resort for English class EspeakFallback:
pkgs/development/python-modules/phonemizer/default.nix +8 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ replaceVars, buildPythonPackage, fetchPypi, fetchpatch2, joblib, segments, attrs, Loading Loading @@ -31,6 +32,13 @@ buildPythonPackage rec { libespeak = "${lib.getLib espeak-ng}/lib/libespeak-ng${stdenv.hostPlatform.extensions.sharedLibrary}"; # FIXME package festival }) # This patch is needed for python3Packages.misaki. See https://github.com/thewh1teagle/espeakng-loader?tab=readme-ov-file#usage-with-phonemizer # and https://github.com/bootphon/phonemizer/pull/191. (fetchpatch2 { name = "pr191-add-option-to-use-custom-espeak-data-path.patch"; url = "https://github.com/bootphon/phonemizer/commit/cc1db4bfaf688fdfb8275fd83d218f06411455e6.patch?full_index=1"; hash = "sha256-PMeX7A9BBVLS3Sk/Lum85GpJzKXM5tULTWSURq3MD8E="; }) ]; propagatedBuildInputs = [ Loading
pkgs/top-level/python-packages.nix +2 −0 Original line number Diff line number Diff line Loading @@ -9080,6 +9080,8 @@ self: super: with self; { misaka = callPackage ../development/python-modules/misaka { }; misaki = callPackage ../development/python-modules/misaki { }; misoc = callPackage ../development/python-modules/misoc { }; miss-hit = callPackage ../development/python-modules/miss-hit { }; Loading