mbrola-voices: extract from mbrola, allow language selection

Allow filtering voices based on any number of extglob patterns.
This commit is contained in:
Martin Weinelt 2024-07-24 15:03:56 +02:00 committed by K900
parent 04d010a9af
commit 0a44760155
3 changed files with 55 additions and 16 deletions

View File

@ -1,4 +1,4 @@
{ stdenv, lib, fetchFromGitHub, runCommandLocal }:
{ stdenv, lib, fetchFromGitHub, runCommandLocal, mbrola-voices }:
let
pname = "mbrola";
@ -12,20 +12,6 @@ let
homepage = "https://github.com/numediart/MBROLA";
};
# Very big (0.65 G) so kept as a fixed-output derivation to limit "duplicates".
voices = fetchFromGitHub {
owner = "numediart";
repo = "MBROLA-voices";
rev = "fe05a0ccef6a941207fd6aaad0b31294a1f93a51"; # using latest commit
sha256 = "1w0y2xjp9rndwdjagp2wxh656mdm3d6w9cs411g27rjyfy1205a0";
name = "${pname}-voices-${version}";
meta = meta // {
description = "Speech synthesizer based on the concatenation of diphones (voice files)";
homepage = "https://github.com/numediart/MBROLA-voices";
};
};
bin = stdenv.mkDerivation {
pname = "${pname}-bin";
inherit version;
@ -60,7 +46,7 @@ in
}
''
mkdir -p "$out/share/mbrola"
ln -s '${voices}/data' "$out/share/mbrola/voices"
ln -s '${mbrola-voices}/data' "$out/share/mbrola/voices"
ln -s '${bin}/bin' "$out/"
''

View File

@ -0,0 +1,51 @@
{
lib,
stdenv,
fetchFromGitHub,
unstableGitUpdater,
mbrola,
languages ? [ ],
}:
let
src = fetchFromGitHub {
owner = "numediart";
repo = "MBROLA-voices";
rev = "fe05a0ccef6a941207fd6aaad0b31294a1f93a51";
hash = "sha256-QBUggnde5iNeCESzxE0btVVTDOxc3Kdk483mdGUXHvA=";
};
meta = {
description = "Speech synthesizer based on the concatenation of diphones (voice files)";
homepage = "https://github.com/numediart/MBROLA-voices";
license = mbrola.meta.license;
};
in
if (languages == [ ]) then
src // { inherit meta; }
else
stdenv.mkDerivation {
pname = "mbrola-voices";
version = "0-unstable-2020-03-30";
inherit src;
postPatch = ''
shopt -s extglob
pushd data
rm -rfv !(${lib.concatStringsSep "|" languages})
popd
'';
installPhase = ''
runHook preInstall
mkdir $out
cp -R data $out/
runHook postInstall
'';
inherit meta;
}

View File

@ -32153,6 +32153,8 @@ with pkgs;
mbrola = callPackage ../applications/audio/mbrola { };
mbrola-voices = callPackage ../applications/audio/mbrola/voices.nix { };
mcpp = callPackage ../development/compilers/mcpp { };
mda_lv2 = callPackage ../applications/audio/mda-lv2 { };