Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ stdenv 2, lib 3, substituteAll 4, pkg-config 5, fetchurl 6, python3Packages 7, gettext 8, itstool 9, libtool 10, texinfo 11, util-linux 12, autoreconfHook 13, glib 14, dotconf 15, libsndfile 16, withLibao ? true, libao 17, withPulse ? false, libpulseaudio 18, withAlsa ? false, alsa-lib 19, withOss ? false 20, withFlite ? true, flite 21, withEspeak ? true, espeak, sonic, pcaudiolib 22, mbrola 23, withPico ? true, svox 24}: 25 26let 27 inherit (python3Packages) python pyxdg wrapPython; 28in stdenv.mkDerivation rec { 29 pname = "speech-dispatcher"; 30 version = "0.11.2"; 31 32 src = fetchurl { 33 url = "https://github.com/brailcom/speechd/releases/download/${version}/${pname}-${version}.tar.gz"; 34 sha256 = "sha256-i0ZJkl5oy+GntMCge7BBznc4s1yQamAr+CmG2xqg82Q="; 35 }; 36 37 patches = [ 38 (substituteAll { 39 src = ./fix-paths.patch; 40 utillinux = util-linux; 41 }) 42 ] ++ lib.optionals (withEspeak && espeak.mbrolaSupport) [ 43 # Replace FHS paths. 44 (substituteAll { 45 src = ./fix-mbrola-paths.patch; 46 inherit espeak mbrola; 47 }) 48 ]; 49 50 nativeBuildInputs = [ 51 pkg-config 52 autoreconfHook 53 gettext 54 libtool 55 itstool 56 texinfo 57 wrapPython 58 ]; 59 60 buildInputs = [ 61 glib 62 dotconf 63 libsndfile 64 libao 65 libpulseaudio 66 alsa-lib 67 python 68 ] ++ lib.optionals withEspeak [ 69 espeak 70 sonic 71 pcaudiolib 72 ] ++ lib.optionals withFlite [ 73 flite 74 ] ++ lib.optionals withPico [ 75 svox 76 ]; 77 78 pythonPath = [ 79 pyxdg 80 ]; 81 82 configureFlags = [ 83 # Audio method falls back from left to right. 84 "--with-default-audio-method=\"libao,pulse,alsa,oss\"" 85 "--with-systemdsystemunitdir=${placeholder "out"}/lib/systemd/system" 86 ] ++ lib.optionals withPulse [ 87 "--with-pulse" 88 ] ++ lib.optionals withAlsa [ 89 "--with-alsa" 90 ] ++ lib.optionals withLibao [ 91 "--with-libao" 92 ] ++ lib.optionals withOss [ 93 "--with-oss" 94 ] ++ lib.optionals withEspeak [ 95 "--with-espeak-ng" 96 ] ++ lib.optionals withPico [ 97 "--with-pico" 98 ]; 99 100 postPatch = '' 101 substituteInPlace src/modules/pico.c --replace "/usr/share/pico/lang" "${svox}/share/pico/lang" 102 ''; 103 104 postInstall = '' 105 wrapPythonPrograms 106 ''; 107 108 enableParallelBuilding = true; 109 110 meta = with lib; { 111 description = "Common interface to speech synthesis"; 112 homepage = "https://devel.freebsoft.org/speechd"; 113 license = licenses.gpl2Plus; 114 maintainers = with maintainers; [ 115 berce 116 jtojnar 117 ]; 118 platforms = platforms.linux; 119 }; 120}