at master 2.6 kB view raw
1{ 2 addict, 3 buildPythonPackage, 4 espeak-ng, 5 fetchFromGitHub, 6 fetchpatch2, 7 fugashi, 8 hatchling, 9 jaconv, 10 jamo, 11 jieba, 12 lib, 13 nltk, 14 num2words, 15 ordered-set, 16 phonemizer, 17 pip, 18 pypinyin, 19 pythonOlder, 20 regex, 21 replaceVars, 22 spacy-curated-transformers, 23 spacy, 24 pytestCheckHook, 25 stdenv, 26 torch, 27 transformers, 28 unidic, 29}: 30 31buildPythonPackage { 32 pname = "misaki"; 33 version = "0-unstable-2025-06-16"; 34 pyproject = true; 35 36 src = fetchFromGitHub { 37 owner = "hexgrad"; 38 repo = "misaki"; 39 rev = "49ddead831fc1a46beab3f9cb6064d93fd3f6347"; 40 hash = "sha256-XkmCG0Vkw/iyLNmwhaW5gp6sg8ieHFeK6fBJ3Jb+J8Q="; 41 }; 42 43 patches = [ 44 (fetchpatch2 { 45 name = "pr82-remove-pip-dependency.patch"; 46 url = "https://github.com/hexgrad/misaki/commit/7d2fdff9fe046dd52b638bbb1b243fb789f4cb31.patch?full_index=1"; 47 hash = "sha256-N796YWrGe51FYVdxbQ8omJxeGdvOAiKEUKhhm10TQO8="; 48 }) 49 (replaceVars ./set-espeak-paths.patch { 50 espeak-library-path = "${lib.getLib espeak-ng}/lib/libespeak-ng${stdenv.hostPlatform.extensions.sharedLibrary}"; 51 espeak-data-path = "${lib.getLib espeak-ng}/share/espeak-ng-data"; 52 }) 53 ]; 54 55 build-system = [ 56 hatchling 57 ]; 58 59 dependencies = [ 60 addict 61 regex 62 ]; 63 64 # See https://github.com/hexgrad/misaki/blob/main/pyproject.toml#L26 65 passthru.optional-dependencies = { 66 en = [ 67 num2words 68 spacy 69 spacy-curated-transformers 70 phonemizer 71 # phonemizer-fork -- we already patch phonemizer in nixpkgs, no need for the "-fork" version 72 # espeakng-loader -- ./set-espeak-paths.patch obviates the need for this 73 torch 74 transformers 75 ]; 76 ja = [ 77 fugashi 78 jaconv 79 # mojimoji -- not packaged as of 2025-06-16 80 unidic 81 # pyopenjtalk -- not packaged as of 2025-06-16 82 ]; 83 ko = [ 84 jamo 85 nltk 86 ]; 87 zh = [ 88 jieba 89 ordered-set 90 pypinyin 91 # cn2an -- not packaged as of 2025-06-16 92 # pypinyin-dict -- not packaged as of 2025-06-16 93 ]; 94 vi = [ 95 num2words 96 spacy 97 spacy-curated-transformers 98 # underthesea -- not packaged as of 2025-06-16 99 ]; 100 # he = [ mishkal-hebrew ]; -- not packaged as of 2025-06-16 101 }; 102 103 # Package does not have tests as of 2025-06-16, but phonemizer is required for 104 # pythonImportsCheck. 105 nativeCheckInputs = [ phonemizer ]; 106 107 pythonImportsCheck = [ 108 "misaki" 109 "misaki.espeak" 110 ]; 111 112 meta = { 113 description = "G2P engine for TTS"; 114 homepage = "https://github.com/hexgrad/misaki"; 115 license = lib.licenses.asl20; 116 maintainers = with lib.maintainers; [ samuela ]; 117 }; 118}