15 , withLibao ? true, libao
16 , withPulse ? false, libpulseaudio
17 , withAlsa ? false, alsaLib
19 , withFlite ? true, flite
20 # , withFestival ? false, festival-freebsoft-utils
21 , withEspeak ? true, espeak, sonic, pcaudiolib
22 , withPico ? true, svox
23 # , withIvona ? false, libdumbtts
27 inherit (lib) optional optionals;
28 inherit (python3Packages) python pyxdg wrapPython;
30 # speechd hard-codes espeak, even when built without support for it.
31 selectedDefaultModule =
36 else if withFlite then
39 throw "You need to enable at least one output module.";
40 in stdenv.mkDerivation rec {
41 pname = "speech-dispatcher";
45 url = "https://github.com/brailcom/speechd/releases/download/${version}/${pname}-${version}.tar.gz";
46 sha256 = "sha256-sGMZ8gHhXlbGKWZTr1vPwwDLNI6XLVF9+LBurHfq4tw=";
51 src = ./fix-paths.patch;
52 utillinux = util-linux;
74 ] ++ optionals withEspeak [
78 ] ++ optional withFlite flite
79 ++ optional withPico svox
80 # TODO: add flint/festival support with festival-freebsoft-utils package
81 # ++ optional withFestival festival-freebsoft-utils
82 # TODO: add Ivona support with libdumbtts package
83 # ++ optional withIvona libdumbtts
86 pythonPath = [ pyxdg ];
89 # Audio method falls back from left to right.
90 "--with-default-audio-method=\"libao,pulse,alsa,oss\""
91 "--with-systemdsystemunitdir=${placeholder "out"}/lib/systemd/system"
92 ] ++ optional withPulse "--with-pulse"
93 ++ optional withAlsa "--with-alsa"
94 ++ optional withLibao "--with-libao"
95 ++ optional withOss "--with-oss"
96 ++ optional withEspeak "--with-espeak-ng"
97 ++ optional withPico "--with-pico"
98 # ++ optional withFestival "--with-flint"
99 # ++ optional withIvona "--with-ivona"
103 substituteInPlace config/speechd.conf --replace "DefaultModule espeak" "DefaultModule ${selectedDefaultModule}"
104 substituteInPlace src/modules/pico.c --replace "/usr/share/pico/lang" "${svox}/share/pico/lang"
111 enableParallelBuilding = true;
114 description = "Common interface to speech synthesis";
115 homepage = "https://devel.freebsoft.org/speechd";
116 license = licenses.gpl2Plus;
117 maintainers = with maintainers; [ berce ];
118 platforms = platforms.linux;