Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

speechd: 0.8.5 -> 0.8.8, refactored #32924

Merged
merged 2 commits into from Dec 22, 2017
Merged

speechd: 0.8.5 -> 0.8.8, refactored #32924

merged 2 commits into from Dec 22, 2017

Conversation

berce
Copy link
Contributor

@berce berce commented Dec 21, 2017

Motivation for this change

Add support for pulseaudio.
Add support for espeak-ng.
Apply best packaging practices I know so far.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@berce berce mentioned this pull request Dec 21, 2017
8 tasks
}:

stdenv.mkDerivation rec {
with lib;
buildPythonApplication rec {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is definitely not a python application, it is a C library.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it worked so well :-(.

spd-conf is a python application, and doesn't work after the requested change.
spd-say and speech-dispatcher work with both approaches.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, you would also need to revert the previous python wrapping.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

buildInputs = [ libtool glib dotconf libsndfile libao libpulseaudio alsaLib ]
++ optionals withEspeak-ng [ espeak-ng sonic pcaudiolib ]
++ optional withPico svox
# TODO: add flint/festival support with festival-freebsoft-utils package
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

flite is separate from festival and it is already packaged.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added flite.
flint is (related to) festival.

"--with-alsa"
"--with-libao"
"--with-oss"
"--with-default-audio-method=\"pulse,alsa,libao,oss\""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think only one method can be default

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's documented in the source. It will automatically fallback from left to right.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat.


propagatedBuildInputs = [ pyxdg ];

buildInputs = [ libtool glib dotconf libsndfile libao libpulseaudio alsaLib ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to disable the other back-ends by default. libao already takes care of pulseaudio support and who uses alsa nowadays.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@jtojnar
Copy link
Contributor

jtojnar commented Dec 21, 2017

Hmm, that was fast. While at it, you can also update espeak master...jtojnar:speechd

I also suspect that the reason default speech synthesizer did not work is DefaultModule espeak in config/speechd.conf. We will probably want to patch it.

@berce
Copy link
Contributor Author

berce commented Dec 21, 2017

You also had done quite some part of the work already.
I think it's ready for squash and merge. Do you agree? Or can you convince me to not use buildPythonApplication?

@@ -52,7 +58,7 @@ buildPythonApplication rec {

meta = with stdenv.lib; {
description = "Common interface to speech synthesis";
homepage = http://www.freebsoft.org/speechd;
homepage = http://devel.freebsoft.org/speechd;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is HTTPS.

@berce
Copy link
Contributor Author

berce commented Dec 21, 2017

espeak-ng (many languages) and flite (en only) work fine.
pico is available, but has no sound output.

@jtojnar
Copy link
Contributor

jtojnar commented Dec 21, 2017

I think it's ready for squash and merge. Do you agree? Or can you convince me to not use buildPythonApplication?

Basically the issue lies in semantics, speechd is not a python application with a binary component, it is a library with a python helper.

@jtojnar
Copy link
Contributor

jtojnar commented Dec 21, 2017

This fixes the default module: dbbefea

@berce
Copy link
Contributor Author

berce commented Dec 21, 2017

Setting the default module looks fine in the speechd.conf file, but I still have no sound by default.
spd-conf seems outdated: espeak-ng can't be selected.

@jtojnar
Copy link
Contributor

jtojnar commented Dec 21, 2017

You might want to delete ~/.config/speech-dispatcher/ generated by the spd-conf for the bundled config to be used. As for the missing espeak-ng, I also noticed that, will check the source code.

, withAlsa ? false, alsaLib
, withOss ? false
, withFlite ? true, flite
, withFestival ? false # TODO: , festival-freebsoft-utils
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would comment out the whole attribute, since it does nothing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idem for Ivona.
Then also in the configureFlags the optional arguments.
Done.

, withOss ? false
, withFlite ? true, flite
, withFestival ? false # TODO: , festival-freebsoft-utils
, withEspeak-ng ? true, espeak-ng, sonic, pcaudiolib
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nix calls espeak-ng espeak, the old one is espeak-classic. We should respect the Nix convention here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.
It makes the file contents confusing however: where to write -ng and where not?

, withPico ? true, svox
, withIvona ? false # TODO: , libdumbtts
, defaultModule ? null
, defaultLang ? "en"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would leave this for a NixOS module. Actually, I would even remove the defaultModule argument since selectedDefaultModule is more of a bugfix, i intend to send a pull request fixing this upstream.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

stdenv.mkDerivation rec {
with lib;
let
selectedDefaultModule =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add here a comment like “speechd hard-codes espeak even when built without a support for it.”

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


hardeningDisable = [ "format" ];
propagatedBuildInputs = [ pyxdg ];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pyxdg is already listed in pythonPath below.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@jtojnar
Copy link
Contributor

jtojnar commented Dec 22, 2017

@GrahamcOfBorg build speechd

Copy link

@GrahamcOfBorg GrahamcOfBorg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Failure for system: x86_64-darwin

Package ‘speech-dispatcher-0.8.8’ in /Users/graham/nix-borg/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/grahamc-zoidberg/pkgs/development/libraries/speechd/default.nix:75 is not supported on ‘x86_64-darwin’, refusing to evaluate.

a) For `nixos-rebuild` you can set
  { nixpkgs.config.allowBroken = true; }
in configuration.nix to override this.

b) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
  { allowBroken = true; }
to ~/.config/nixpkgs/config.nix.

Copy link

@GrahamcOfBorg GrahamcOfBorg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Success for system: x86_64-linux

shrinking /nix/store/fn2cik14aignfmz2jy5krq3ccz1cbhxq-speech-dispatcher-0.8.8/lib/speech-dispatcher-modules/sd_cicero
shrinking /nix/store/fn2cik14aignfmz2jy5krq3ccz1cbhxq-speech-dispatcher-0.8.8/lib/speech-dispatcher-modules/sd_pico
shrinking /nix/store/fn2cik14aignfmz2jy5krq3ccz1cbhxq-speech-dispatcher-0.8.8/lib/speech-dispatcher/spd_pulse.so
shrinking /nix/store/fn2cik14aignfmz2jy5krq3ccz1cbhxq-speech-dispatcher-0.8.8/lib/speech-dispatcher/spd_oss.so
shrinking /nix/store/fn2cik14aignfmz2jy5krq3ccz1cbhxq-speech-dispatcher-0.8.8/lib/speech-dispatcher/spd_libao.so
shrinking /nix/store/fn2cik14aignfmz2jy5krq3ccz1cbhxq-speech-dispatcher-0.8.8/lib/speech-dispatcher/spd_alsa.so
stripping (with flags -S) in /nix/store/fn2cik14aignfmz2jy5krq3ccz1cbhxq-speech-dispatcher-0.8.8/lib  /nix/store/fn2cik14aignfmz2jy5krq3ccz1cbhxq-speech-dispatcher-0.8.8/bin 
patching script interpreter paths in /nix/store/fn2cik14aignfmz2jy5krq3ccz1cbhxq-speech-dispatcher-0.8.8
checking for references to /tmp/nix-build-speech-dispatcher-0.8.8.drv-0 in /nix/store/fn2cik14aignfmz2jy5krq3ccz1cbhxq-speech-dispatcher-0.8.8...
/nix/store/fn2cik14aignfmz2jy5krq3ccz1cbhxq-speech-dispatcher-0.8.8

Copy link

@GrahamcOfBorg GrahamcOfBorg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Success for system: aarch64-linux

shrinking /nix/store/qnbn0sxsci6nkzwxxvidphk5ffh5wsq6-speech-dispatcher-0.8.8/lib/speech-dispatcher/spd_oss.so
shrinking /nix/store/qnbn0sxsci6nkzwxxvidphk5ffh5wsq6-speech-dispatcher-0.8.8/lib/speech-dispatcher/spd_libao.so
shrinking /nix/store/qnbn0sxsci6nkzwxxvidphk5ffh5wsq6-speech-dispatcher-0.8.8/lib/speech-dispatcher/spd_alsa.so
shrinking /nix/store/qnbn0sxsci6nkzwxxvidphk5ffh5wsq6-speech-dispatcher-0.8.8/bin/spdsend
shrinking /nix/store/qnbn0sxsci6nkzwxxvidphk5ffh5wsq6-speech-dispatcher-0.8.8/bin/spd-say
shrinking /nix/store/qnbn0sxsci6nkzwxxvidphk5ffh5wsq6-speech-dispatcher-0.8.8/bin/speech-dispatcher
stripping (with flags -S) in /nix/store/qnbn0sxsci6nkzwxxvidphk5ffh5wsq6-speech-dispatcher-0.8.8/lib  /nix/store/qnbn0sxsci6nkzwxxvidphk5ffh5wsq6-speech-dispatcher-0.8.8/bin
patching script interpreter paths in /nix/store/qnbn0sxsci6nkzwxxvidphk5ffh5wsq6-speech-dispatcher-0.8.8
checking for references to /build in /nix/store/qnbn0sxsci6nkzwxxvidphk5ffh5wsq6-speech-dispatcher-0.8.8...
/nix/store/qnbn0sxsci6nkzwxxvidphk5ffh5wsq6-speech-dispatcher-0.8.8

@jtojnar
Copy link
Contributor

jtojnar commented Dec 22, 2017

I re-added python dependency to build python bindings and changed python3Packages.callPackage back to callPackage.

@jtojnar jtojnar merged commit 857a71c into NixOS:master Dec 22, 2017
@jtojnar
Copy link
Contributor

jtojnar commented Dec 22, 2017

Thanks for your great work!

@berce
Copy link
Contributor Author

berce commented Dec 23, 2017

It's done with pleasure. Thanks for the support, and constructive feedback.

@berce berce deleted the speechd branch December 23, 2017 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants