Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add systemd units as well.
- Loading branch information
Showing
1 changed file
with
43 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,68 @@ | ||
{ fetchurl, lib, stdenv, intltool, libtool, pkgconfig, glib, dotconf, libsndfile | ||
, libao, python3Packages | ||
{ stdenv, lib, fetchurl, autoreconfHook, intltool, pkgconfig, texinfo, writeText | ||
, glib, dotconf, libsndfile | ||
, alsaLib, libao, libpulseaudio, python3Packages | ||
, withEspeak ? false, espeak | ||
, withPico ? true, svox | ||
}: | ||
|
||
stdenv.mkDerivation rec { | ||
let | ||
service = writeText "speechd.service" '' | ||
[Unit] | ||
Description=Speech-Dispatcher a high-level device independent layer for speech synthesis | ||
[Service] | ||
Type=forking | ||
RuntimeDirectory=speech-dispatcher | ||
# We set --log-dir to something which isn't a directory so speechd is forced to log to stdout | ||
ExecStart=@out@/bin/speech-dispatcher --run-daemon --timeout 0 --pid-file %t/speech-dispatcher/pid --log-dir /dev/stdout | ||
PIDFile=%t/speech-dispatcher/pid | ||
Restart=on-failure | ||
PrivateTmp=true | ||
''; | ||
|
||
in stdenv.mkDerivation rec { | ||
name = "speech-dispatcher-${version}"; | ||
version = "0.8.5"; | ||
version = "0.8.7"; | ||
|
||
src = fetchurl { | ||
url = "http://www.freebsoft.org/pub/projects/speechd/${name}.tar.gz"; | ||
sha256 = "18jlxnhlahyi6njc6l6576hfvmzivjjgfjyd2n7vvrvx9inphjrb"; | ||
sha256 = "0d5i9ig2di8jffcgnhrkl6x4l3bwdan9irs6pjzi9paln2ny22r0"; | ||
}; | ||
|
||
buildInputs = [ intltool libtool glib dotconf libsndfile libao python3Packages.python ] | ||
++ lib.optional withEspeak espeak | ||
++ lib.optional withPico svox; | ||
nativeBuildInputs = [ pkgconfig python3Packages.wrapPython ]; | ||
buildInputs = [ | ||
glib dotconf libsndfile python3Packages.python intltool | ||
alsaLib libao libpulseaudio | ||
] ++ lib.optional withEspeak espeak | ||
++ lib.optional withPico svox; | ||
|
||
nativeBuildInputs = [ autoreconfHook pkgconfig python3Packages.wrapPython texinfo ]; | ||
|
||
hardeningDisable = [ "format" ]; | ||
enableParallelBuilding = true; | ||
|
||
# hardeningDisable = [ "format" ]; | ||
|
||
pythonPath = with python3Packages; [ pyxdg ]; | ||
|
||
postPatch = lib.optionalString withPico '' | ||
sed -i 's,/usr/share/pico/lang/,${svox}/share/pico/lang/,g' src/modules/pico.c | ||
substituteInPlace src/modules/pico.c \ | ||
--replace /usr/share/pico/lang/ ${svox}/share/pico/lang/ | ||
''; | ||
|
||
postInstall = '' | ||
mkdir -p $out/lib/systemd/{system,user} | ||
wrapPythonPrograms | ||
for d in system user ; do | ||
substitute ${service} $out/lib/systemd/$d/speechd.service \ | ||
--subst-var out | ||
done | ||
''; | ||
|
||
meta = with stdenv.lib; { | ||
description = "Common interface to speech synthesis"; | ||
homepage = http://www.freebsoft.org/speechd; | ||
license = licenses.gpl2Plus; | ||
platforms = platforms.linux; | ||
homepage = https://www.freebsoft.org/speechd; | ||
license = licenses.gpl2Plus; | ||
platforms = platforms.linux; | ||
}; | ||
} |