nixpkgs/pkgs/by-name/sp/speechd/package.nix
Silvan Mosberger 4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00

153 lines
2.8 KiB
Nix

{
stdenv,
lib,
substituteAll,
pkg-config,
fetchurl,
python3Packages,
gettext,
itstool,
libtool,
texinfo,
util-linux,
autoreconfHook,
glib,
dotconf,
libsndfile,
withLibao ? true,
libao,
withPulse ? false,
libpulseaudio,
withAlsa ? false,
alsa-lib,
withOss ? false,
withFlite ? true,
flite,
withEspeak ? true,
espeak,
sonic,
pcaudiolib,
mbrola,
withPico ? true,
svox,
libsOnly ? false,
}:
let
inherit (python3Packages) python pyxdg wrapPython;
in
stdenv.mkDerivation rec {
pname = "speech-dispatcher";
version = "0.11.5";
src = fetchurl {
url = "https://github.com/brailcom/speechd/releases/download/${version}/${pname}-${version}.tar.gz";
sha256 = "sha256-HOR1n/q7rxrrQzpewHOb4Gdum9+66URKezvhsq8+wSs=";
};
patches =
[
(substituteAll {
src = ./fix-paths.patch;
utillinux = util-linux;
})
]
++ lib.optionals (withEspeak && espeak.mbrolaSupport) [
# Replace FHS paths.
(substituteAll {
src = ./fix-mbrola-paths.patch;
inherit espeak mbrola;
})
];
nativeBuildInputs = [
pkg-config
autoreconfHook
gettext
libtool
itstool
texinfo
wrapPython
];
buildInputs =
[
glib
dotconf
libsndfile
libao
libpulseaudio
alsa-lib
python
]
++ lib.optionals withEspeak [
espeak
sonic
pcaudiolib
]
++ lib.optionals withFlite [
flite
]
++ lib.optionals withPico [
svox
];
pythonPath = [
pyxdg
];
configureFlags =
[
# Audio method falls back from left to right.
"--with-default-audio-method=\"libao,pulse,alsa,oss\""
"--with-systemdsystemunitdir=${placeholder "out"}/lib/systemd/system"
]
++ lib.optionals withPulse [
"--with-pulse"
]
++ lib.optionals withAlsa [
"--with-alsa"
]
++ lib.optionals withLibao [
"--with-libao"
]
++ lib.optionals withOss [
"--with-oss"
]
++ lib.optionals withEspeak [
"--with-espeak-ng"
]
++ lib.optionals withPico [
"--with-pico"
];
postPatch = ''
substituteInPlace src/modules/pico.c --replace "/usr/share/pico/lang" "${svox}/share/pico/lang"
'';
postInstall =
if libsOnly then
''
rm -rf $out/{bin,etc,lib/speech-dispatcher,lib/systemd,libexec,share}
''
else
''
wrapPythonPrograms
'';
enableParallelBuilding = true;
meta = with lib; {
description =
"Common interface to speech synthesis" + lib.optionalString libsOnly " - client libraries only";
homepage = "https://devel.freebsoft.org/speechd";
license = licenses.gpl2Plus;
maintainers = with maintainers; [
berce
jtojnar
];
platforms = platforms.linux;
mainProgram = "speech-dispatcher";
};
}