Skip to content

Commit

Permalink
Merge #329658: speechd: use minimal variant
Browse files Browse the repository at this point in the history
Also add it and inject big variant impurely.

Merge into staging-next
  • Loading branch information
vcunat committed Jul 26, 2024
2 parents 9e852fd + ddaa025 commit b8688ce
Show file tree
Hide file tree
Showing 23 changed files with 150 additions and 52 deletions.
1 change: 1 addition & 0 deletions nixos/modules/module-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@
./security/systemd-confinement.nix
./security/tpm2.nix
./security/wrappers/default.nix
./services/accessibility/speechd.nix
./services/admin/docuum.nix
./services/admin/meshcentral.nix
./services/admin/oxidized.nix
Expand Down
10 changes: 10 additions & 0 deletions nixos/modules/profiles/installation-device.nix
Original file line number Diff line number Diff line change
Expand Up @@ -126,5 +126,15 @@ with lib;

# allow nix-copy to live system
nix.settings.trusted-users = [ "root" "nixos" ];

# Install less voices for speechd to save some space
services.speechd.package = pkgs.speechd.override {
mbrola = pkgs.mbrola.override {
mbrola-voices = pkgs.mbrola-voices.override {
# only ship with one voice per language
languages = [ "*1" ];
};
};
};
};
}
33 changes: 33 additions & 0 deletions nixos/modules/services/accessibility/speechd.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
config,
lib,
pkgs,
...
}:
let
cfg = config.services.speechd;
inherit (lib)
getExe
mkEnableOption
mkIf
mkPackageOption
;
in
{
options.services.speechd = {
# FIXME: figure out how to deprecate this EXTREMELY CAREFULLY
enable = mkEnableOption "speech-dispatcher speech synthesizer daemon" // {
default = true;
};
package = mkPackageOption pkgs "speechd" { };
};

# FIXME: speechd 0.12 (or whatever the next version is)
# will support socket activation, so switch to that once it's out.
config = mkIf cfg.enable {
environment = {
systemPackages = [ cfg.package ];
sessionVariables.SPEECHD_CMD = getExe cfg.package;
};
};
}
4 changes: 2 additions & 2 deletions pkgs/applications/accessibility/dasher/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
, libxslt
, libxml2
, speechSupport ? true
, speechd
, speechd-minimal
}:

stdenv.mkDerivation {
Expand Down Expand Up @@ -56,7 +56,7 @@ stdenv.mkDerivation {
# at-spi2 needs dbus to be recognized by pkg-config
at-spi2-core
dbus
] ++ lib.optional speechSupport speechd;
] ++ lib.optional speechSupport speechd-minimal;

enableParallelBuilding = true;

Expand Down
18 changes: 2 additions & 16 deletions pkgs/applications/audio/mbrola/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ stdenv, lib, fetchFromGitHub, runCommandLocal }:
{ stdenv, lib, fetchFromGitHub, runCommandLocal, mbrola-voices }:

let
pname = "mbrola";
Expand All @@ -12,20 +12,6 @@ let
homepage = "https://github.com/numediart/MBROLA";
};

# Very big (0.65 G) so kept as a fixed-output derivation to limit "duplicates".
voices = fetchFromGitHub {
owner = "numediart";
repo = "MBROLA-voices";
rev = "fe05a0ccef6a941207fd6aaad0b31294a1f93a51"; # using latest commit
sha256 = "1w0y2xjp9rndwdjagp2wxh656mdm3d6w9cs411g27rjyfy1205a0";

name = "${pname}-voices-${version}";
meta = meta // {
description = "Speech synthesizer based on the concatenation of diphones (voice files)";
homepage = "https://github.com/numediart/MBROLA-voices";
};
};

bin = stdenv.mkDerivation {
pname = "${pname}-bin";
inherit version;
Expand Down Expand Up @@ -60,7 +46,7 @@ in
}
''
mkdir -p "$out/share/mbrola"
ln -s '${voices}/data' "$out/share/mbrola/voices"
ln -s '${mbrola-voices}/data' "$out/share/mbrola/voices"
ln -s '${bin}/bin' "$out/"
''

51 changes: 51 additions & 0 deletions pkgs/applications/audio/mbrola/voices.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
lib,
stdenv,
fetchFromGitHub,
unstableGitUpdater,
mbrola,
languages ? [ ],
}:

let
src = fetchFromGitHub {
owner = "numediart";
repo = "MBROLA-voices";
rev = "fe05a0ccef6a941207fd6aaad0b31294a1f93a51";
hash = "sha256-QBUggnde5iNeCESzxE0btVVTDOxc3Kdk483mdGUXHvA=";
};

meta = {
description = "Speech synthesizer based on the concatenation of diphones (voice files)";
homepage = "https://github.com/numediart/MBROLA-voices";
license = mbrola.meta.license;
};
in

if (languages == [ ]) then
src // { inherit meta; }
else
stdenv.mkDerivation {
pname = "mbrola-voices";
version = "0-unstable-2020-03-30";

inherit src;

postPatch = ''
shopt -s extglob
pushd data
rm -rfv !(${lib.concatStringsSep "|" languages})
popd
'';

installPhase = ''
runHook preInstall
mkdir $out
cp -R data $out/
runHook postInstall
'';

inherit meta;
}
4 changes: 2 additions & 2 deletions pkgs/applications/audio/rhvoice/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
, glibmm
, libpulseaudio
, libao
, speechd
, speechd-minimal
}:

stdenv.mkDerivation rec {
Expand Down Expand Up @@ -42,7 +42,7 @@ stdenv.mkDerivation rec {
glibmm
libpulseaudio
libao
speechd
speechd-minimal
];

meta = {
Expand Down
4 changes: 2 additions & 2 deletions pkgs/applications/misc/calibre/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
, qmake
, qtbase
, qtwayland
, speechd
, speechd-minimal
, sqlite
, wrapQtAppsHook
, xdg-utils
Expand Down Expand Up @@ -132,7 +132,7 @@ stdenv.mkDerivation (finalAttrs: {
] ++ lib.optional (unrarSupport) unrardll)
)
xdg-utils
] ++ lib.optional (speechSupport) speechd;
] ++ lib.optional (speechSupport) speechd-minimal;

installPhase = ''
runHook preInstall
Expand Down
6 changes: 3 additions & 3 deletions pkgs/applications/networking/browsers/chromium/common.nix
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
, glib, gtk3, dbus-glib
, libXScrnSaver, libXcursor, libXtst, libxshmfence, libGLU, libGL
, mesa
, pciutils, protobuf, speechd, libXdamage, at-spi2-core
, pciutils, protobuf, speechd-minimal, libXdamage, at-spi2-core
, pipewire
, libva
, libdrm, wayland, libxkbcommon # Ozone
Expand Down Expand Up @@ -196,7 +196,7 @@ let
glib gtk3 dbus-glib
libXScrnSaver libXcursor libXtst libxshmfence libGLU libGL
mesa # required for libgbm
pciutils protobuf speechd libXdamage at-spi2-core
pciutils protobuf speechd-minimal libXdamage at-spi2-core
pipewire
libva
libdrm wayland libxkbcommon
Expand Down Expand Up @@ -224,7 +224,7 @@ let
glib gtk3 dbus-glib
libXScrnSaver libXcursor libXtst libxshmfence libGLU libGL
mesa # required for libgbm
pciutils protobuf speechd libXdamage at-spi2-core
pciutils protobuf speechd-minimal libXdamage at-spi2-core
pipewire
libva
libdrm wayland libxkbcommon
Expand Down
4 changes: 2 additions & 2 deletions pkgs/applications/networking/browsers/firefox/wrapper.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
, pciutils
, sndio
, libjack2
, speechd
, speechd-minimal
, removeReferencesTo
}:

Expand Down Expand Up @@ -98,7 +98,7 @@ let
++ lib.optional sndioSupport sndio
++ lib.optional jackSupport libjack2
++ lib.optional smartcardSupport opensc
++ lib.optional (cfg.speechSynthesisSupport or true) speechd
++ lib.optional (cfg.speechSynthesisSupport or true) speechd-minimal
++ pkcs11Modules
++ gtk_modules;
gtk_modules = [ libcanberra-gtk3 ];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
, libXi, libXrandr, libXrender, libXtst, libxcb, libxshmfence, mesa, nspr, nss
, pango, systemd, libappindicator-gtk3, libdbusmenu, writeScript, python3, runCommand
, libunity
, speechd
, speechd-minimal
, wayland
, branch
, withOpenASAR ? false, openasar
Expand Down Expand Up @@ -91,7 +91,7 @@ stdenv.mkDerivation rec {
libappindicator-gtk3
libdbusmenu
wayland
] ++ lib.optional withTTS speechd);
] ++ lib.optional withTTS speechd-minimal);

installPhase = ''
runHook preInstall
Expand Down
6 changes: 3 additions & 3 deletions pkgs/applications/networking/mumble/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
, jackSupport ? false, libjack2
, pipewireSupport ? true, pipewire
, pulseSupport ? true, libpulseaudio
, speechdSupport ? false, speechd
, speechdSupport ? false, speechd-minimal
}:

let
Expand Down Expand Up @@ -53,7 +53,7 @@ let
buildInputs = [ flac libogg libopus libsndfile libvorbis qt5.qtsvg rnnoise speex ]
++ lib.optional (!jackSupport) alsa-lib
++ lib.optional jackSupport libjack2
++ lib.optional speechdSupport speechd
++ lib.optional speechdSupport speechd-minimal
++ lib.optional pulseSupport libpulseaudio
++ lib.optional pipewireSupport pipewire;

Expand All @@ -72,7 +72,7 @@ let
++ lib.optional (!pipewireSupport) "-D pipewire=OFF"
++ lib.optional jackSupport "-D alsa=OFF -D jackaudio=ON";

env.NIX_CFLAGS_COMPILE = lib.optionalString speechdSupport "-I${speechd}/include/speech-dispatcher";
env.NIX_CFLAGS_COMPILE = lib.optionalString speechdSupport "-I${speechd-minimal}/include/speech-dispatcher";

postFixup = ''
wrapProgram $out/bin/mumble \
Expand Down
4 changes: 2 additions & 2 deletions pkgs/by-name/bo/boilr/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
, xorg
, perl
, openssl
, speechd
, speechd-minimal
, libxkbcommon
, libGL
, wayland
}:
let
rpathLibs = [
speechd
speechd-minimal
openssl
gtk3
libxkbcommon
Expand Down
4 changes: 2 additions & 2 deletions pkgs/by-name/go/google-chrome/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
## Ubuntu
, liberation_ttf, curl, util-linux, xdg-utils, wget
## Arch Linux.
, flac, harfbuzz, icu, libpng, libopus, snappy, speechd
, flac, harfbuzz, icu, libpng, libopus, snappy, speechd-minimal
## Gentoo
, bzip2, libcap

Expand Down Expand Up @@ -54,7 +54,7 @@ let
systemd
libexif pciutils
liberation_ttf curl util-linux wget
flac harfbuzz icu libpng opusWithCustomModes snappy speechd
flac harfbuzz icu libpng opusWithCustomModes snappy speechd-minimal
bzip2 libcap at-spi2-atk at-spi2-core
libkrb5 libdrm libglvnd mesa coreutils
libxkbcommon pipewire wayland
Expand Down
4 changes: 2 additions & 2 deletions pkgs/by-name/or/orca/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
, lsof
, coreutils
, gsettings-desktop-schemas
, speechd
, speechd-minimal
, brltty
, liblouis
, gst_all_1
Expand Down Expand Up @@ -65,7 +65,7 @@ python3.pkgs.buildPythonApplication rec {
brltty
liblouis
psutil
speechd
speechd-minimal
gst-python
setproctitle
];
Expand Down
4 changes: 2 additions & 2 deletions pkgs/development/libraries/qt-5/modules/qtspeech.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{ lib, qtModule, stdenv, speechd, pkg-config }:
{ lib, qtModule, stdenv, speechd-minimal, pkg-config }:

qtModule {
pname = "qtspeech";
propagatedBuildInputs = [ ];
buildInputs = lib.optionals stdenv.isLinux [ speechd ];
buildInputs = lib.optionals stdenv.isLinux [ speechd-minimal ];
nativeBuildInputs = [ pkg-config ];
outputs = [ "out" "dev" ];
}
4 changes: 2 additions & 2 deletions pkgs/development/libraries/qt-6/modules/qtspeech.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
, pkg-config
, flite
, alsa-lib
, speechd
, speechd-minimal
, Cocoa
}:

qtModule {
pname = "qtspeech";
nativeBuildInputs = [ pkg-config ];
buildInputs = lib.optionals stdenv.hostPlatform.isLinux [ flite alsa-lib speechd ];
buildInputs = lib.optionals stdenv.hostPlatform.isLinux [ flite alsa-lib speechd-minimal ];
propagatedBuildInputs = [ qtbase qtmultimedia ]
++ lib.optionals stdenv.hostPlatform.isDarwin [ Cocoa ];
}
Loading

0 comments on commit b8688ce

Please sign in to comment.