Merge pull request #257555 from mweinelt/wyoming-1.2.0
wyoming (1.1.0 -> 1.2.0), wyoming-piper (1.2.0 -> 1.3.2), webrtc-noise-gain (init), wyoming-openwakeword (init)
This commit is contained in:
commit
f33abce165
@ -346,6 +346,7 @@
|
||||
./services/audio/squeezelite.nix
|
||||
./services/audio/tts.nix
|
||||
./services/audio/wyoming/faster-whisper.nix
|
||||
./services/audio/wyoming/openwakeword.nix
|
||||
./services/audio/wyoming/piper.nix
|
||||
./services/audio/ympd.nix
|
||||
./services/backup/automysqlbackup.nix
|
||||
|
157
nixos/modules/services/audio/wyoming/openwakeword.nix
Normal file
157
nixos/modules/services/audio/wyoming/openwakeword.nix
Normal file
@ -0,0 +1,157 @@
|
||||
{ config
|
||||
, lib
|
||||
, pkgs
|
||||
, ...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.services.wyoming.openwakeword;
|
||||
|
||||
inherit (lib)
|
||||
concatMapStringsSep
|
||||
escapeShellArgs
|
||||
mkOption
|
||||
mdDoc
|
||||
mkEnableOption
|
||||
mkIf
|
||||
mkPackageOptionMD
|
||||
types
|
||||
;
|
||||
|
||||
inherit (builtins)
|
||||
toString
|
||||
;
|
||||
|
||||
models = [
|
||||
# wyoming_openwakeword/models/*.tflite
|
||||
"alexa"
|
||||
"hey_jarvis"
|
||||
"hey_mycroft"
|
||||
"hey_rhasspy"
|
||||
"ok_nabu"
|
||||
];
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
meta.buildDocsInSandbox = false;
|
||||
|
||||
options.services.wyoming.openwakeword = with types; {
|
||||
enable = mkEnableOption (mdDoc "Wyoming openWakeWord server");
|
||||
|
||||
package = mkPackageOptionMD pkgs "wyoming-openwakeword" { };
|
||||
|
||||
uri = mkOption {
|
||||
type = strMatching "^(tcp|unix)://.*$";
|
||||
default = "tcp://0.0.0.0:10400";
|
||||
example = "tcp://192.0.2.1:5000";
|
||||
description = mdDoc ''
|
||||
URI to bind the wyoming server to.
|
||||
'';
|
||||
};
|
||||
|
||||
models = mkOption {
|
||||
type = listOf (enum models);
|
||||
default = models;
|
||||
description = mdDoc ''
|
||||
List of wake word models that should be made available.
|
||||
'';
|
||||
};
|
||||
|
||||
preloadModels = mkOption {
|
||||
type = listOf (enum models);
|
||||
default = [
|
||||
"ok_nabu"
|
||||
];
|
||||
description = mdDoc ''
|
||||
List of wake word models to preload after startup.
|
||||
'';
|
||||
};
|
||||
|
||||
threshold = mkOption {
|
||||
type = float;
|
||||
default = 0.5;
|
||||
description = mdDoc ''
|
||||
Activation threshold (0-1), where higher means fewer activations.
|
||||
|
||||
See trigger level for the relationship between activations and
|
||||
wake word detections.
|
||||
'';
|
||||
apply = toString;
|
||||
};
|
||||
|
||||
triggerLevel = mkOption {
|
||||
type = int;
|
||||
default = 1;
|
||||
description = mdDoc ''
|
||||
Number of activations before a detection is registered.
|
||||
|
||||
A higher trigger level means fewer detections.
|
||||
'';
|
||||
apply = toString;
|
||||
};
|
||||
|
||||
extraArgs = mkOption {
|
||||
type = listOf str;
|
||||
default = [ ];
|
||||
description = mdDoc ''
|
||||
Extra arguments to pass to the server commandline.
|
||||
'';
|
||||
apply = escapeShellArgs;
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
systemd.services."wyoming-openwakeword" = {
|
||||
description = "Wyoming openWakeWord server";
|
||||
after = [
|
||||
"network-online.target"
|
||||
];
|
||||
wantedBy = [
|
||||
"multi-user.target"
|
||||
];
|
||||
serviceConfig = {
|
||||
DynamicUser = true;
|
||||
User = "wyoming-openwakeword";
|
||||
# https://github.com/home-assistant/addons/blob/master/openwakeword/rootfs/etc/s6-overlay/s6-rc.d/openwakeword/run
|
||||
ExecStart = ''
|
||||
${cfg.package}/bin/wyoming-openwakeword \
|
||||
--uri ${cfg.uri} \
|
||||
${concatMapStringsSep " " (model: "--model ${model}") cfg.models} \
|
||||
${concatMapStringsSep " " (model: "--preload-model ${model}") cfg.preloadModels} \
|
||||
--threshold ${cfg.threshold} \
|
||||
--trigger-level ${cfg.triggerLevel} ${cfg.extraArgs}
|
||||
'';
|
||||
CapabilityBoundingSet = "";
|
||||
DeviceAllow = "";
|
||||
DevicePolicy = "closed";
|
||||
LockPersonality = true;
|
||||
MemoryDenyWriteExecute = true;
|
||||
PrivateDevices = true;
|
||||
PrivateUsers = true;
|
||||
ProtectHome = true;
|
||||
ProtectHostname = true;
|
||||
ProtectKernelLogs = true;
|
||||
ProtectKernelModules = true;
|
||||
ProtectKernelTunables = true;
|
||||
ProtectControlGroups = true;
|
||||
ProtectProc = "invisible";
|
||||
ProcSubset = "pid";
|
||||
RestrictAddressFamilies = [
|
||||
"AF_INET"
|
||||
"AF_INET6"
|
||||
"AF_UNIX"
|
||||
];
|
||||
RestrictNamespaces = true;
|
||||
RestrictRealtime = true;
|
||||
RuntimeDirectory = "wyoming-openwakeword";
|
||||
SystemCallArchitectures = "native";
|
||||
SystemCallFilter = [
|
||||
"@system-service"
|
||||
"~@privileged"
|
||||
];
|
||||
UMask = "0077";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
{ lib
|
||||
, buildPythonPackage
|
||||
, fetchFromGitHub
|
||||
, stdenv
|
||||
|
||||
# build-system
|
||||
, pybind11
|
||||
, setuptools
|
||||
|
||||
# native dependencies
|
||||
, abseil-cpp
|
||||
, darwin
|
||||
|
||||
# tests
|
||||
, pytestCheckHook
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "webrtc-noise-gain";
|
||||
version = "1.2.2";
|
||||
pyproject = true;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "rhasspy";
|
||||
repo = "webrtc-noise-gain";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-yHuCa2To9/9kD+tLG239I1aepuhcPUV4a4O1TQtBPlE=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
pybind11
|
||||
setuptools
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
abseil-cpp
|
||||
] ++ lib.optionals (stdenv.isDarwin) [
|
||||
darwin.apple_sdk.frameworks.CoreServices
|
||||
];
|
||||
|
||||
pythonImportsCheck = [
|
||||
"webrtc_noise_gain"
|
||||
];
|
||||
|
||||
nativeCheckInputs = [
|
||||
pytestCheckHook
|
||||
];
|
||||
|
||||
meta = with lib; {
|
||||
description = "Tiny wrapper around webrtc-audio-processing for noise suppression/auto gain only";
|
||||
homepage = "https://github.com/rhasspy/webrtc-noise-gain";
|
||||
changelog = "https://github.com/rhasspy/webrtc-noise-gain/blob/${src.rev}/CHANGELOG.md";
|
||||
license = licenses.mit;
|
||||
maintainers = with maintainers; [ hexa ];
|
||||
};
|
||||
}
|
@ -1,16 +1,21 @@
|
||||
{ lib
|
||||
, buildPythonPackage
|
||||
, fetchPypi
|
||||
|
||||
# tests
|
||||
, wyoming-faster-whisper
|
||||
, wyoming-openwakeword
|
||||
, wyoming-piper
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "wyoming";
|
||||
version = "1.1.0";
|
||||
version = "1.2.0";
|
||||
format = "setuptools";
|
||||
|
||||
src = fetchPypi {
|
||||
inherit pname version;
|
||||
hash = "sha256-I5GgDu9HRj6fIX66q3RuDeB13h6dpwxrSBxKhzE+Fus=";
|
||||
hash = "sha256-mgNhc8PMRrwfvGZEcgIvQ/P2dysdDo2juvZccvb2C/g=";
|
||||
};
|
||||
|
||||
pythonImportsCheck = [
|
||||
@ -20,6 +25,14 @@ buildPythonPackage rec {
|
||||
# no tests
|
||||
doCheck = false;
|
||||
|
||||
passthru.tests = {
|
||||
inherit
|
||||
wyoming-faster-whisper
|
||||
wyoming-openwakeword
|
||||
wyoming-piper
|
||||
;
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
description = "Protocol for Rhasspy Voice Assistant";
|
||||
homepage = "https://pypi.org/project/wyoming/";
|
||||
|
63
pkgs/tools/audio/wyoming/openwakeword.nix
Normal file
63
pkgs/tools/audio/wyoming/openwakeword.nix
Normal file
@ -0,0 +1,63 @@
|
||||
{ lib
|
||||
, python3
|
||||
, python3Packages
|
||||
, fetchFromGitHub
|
||||
, fetchpatch
|
||||
}:
|
||||
|
||||
python3.pkgs.buildPythonApplication {
|
||||
pname = "wyoming-openwakeword";
|
||||
version = "1.5.1";
|
||||
pyproject = true;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "rhasspy";
|
||||
repo = "rhasspy3";
|
||||
rev = "e16d7d374a64f671db48142c7b635b327660ebcf";
|
||||
hash = "sha256-SbWsRmR1hfuU3yJbuu+r7M43ugHeNwLgu5S8MqkbCQA=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
(fetchpatch {
|
||||
# import tflite entrypoint from tensorflow
|
||||
url = "https://github.com/rhasspy/rhasspy3/commit/23b1bc9cf1e9aa78453feb11e27d5dafe26de068.patch";
|
||||
hash = "sha256-fjLJ+VI4c8ABBWx1IjZ6nS8MGqdry4rgcThKiaAvz+Q=";
|
||||
})
|
||||
(fetchpatch {
|
||||
# add commandline entrypoint
|
||||
url = "https://github.com/rhasspy/rhasspy3/commit/7662b82cd85e16817a3c6f4153e855bf57436ac3.patch";
|
||||
hash = "sha256-41CLkVDSAJJpZ5irwIf/Z4wHoCuKDrqFBAjKCx7ta50=";
|
||||
})
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
cd programs/wake/openwakeword-lite/server
|
||||
'';
|
||||
|
||||
nativeBuildInputs = with python3Packages; [
|
||||
setuptools
|
||||
wheel
|
||||
];
|
||||
|
||||
propagatedBuildInputs = with python3Packages; [
|
||||
tensorflow-bin
|
||||
webrtc-noise-gain
|
||||
wyoming
|
||||
];
|
||||
|
||||
passthru.optional-dependencies.webrtc = with python3Packages; [
|
||||
webrtc-noise-gain
|
||||
];
|
||||
|
||||
pythonImportsCheck = [
|
||||
"wyoming_openwakeword"
|
||||
];
|
||||
|
||||
meta = with lib; {
|
||||
description = "An open source voice assistant toolkit for many human languages";
|
||||
homepage = "https://github.com/rhasspy/rhasspy3/commit/fe44635132079db74d0c76c6b3553b842aa1e318";
|
||||
license = licenses.mit;
|
||||
maintainers = with maintainers; [ hexa ];
|
||||
mainProgram = "wyoming-openwakeword";
|
||||
};
|
||||
}
|
@ -5,13 +5,13 @@
|
||||
|
||||
python3.pkgs.buildPythonApplication rec {
|
||||
pname = "wyoming-piper";
|
||||
version = "1.2.0";
|
||||
version = "1.3.2";
|
||||
format = "setuptools";
|
||||
|
||||
src = fetchPypi {
|
||||
pname = "wyoming_piper";
|
||||
inherit version;
|
||||
hash = "sha256-cdCWpejHNCjyYtIxGms9yaEerRmFnGllUN7+3uQy4mQ=";
|
||||
hash = "sha256-WyoHwIF3xC5nOa7iQ8/esfdwahbU6YJzK5G2Vi3mV4M=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
|
@ -37468,6 +37468,8 @@ with pkgs;
|
||||
|
||||
wyoming-faster-whisper = callPackage ../tools/audio/wyoming/faster-whisper.nix { };
|
||||
|
||||
wyoming-openwakeword = callPackage ../tools/audio/wyoming/openwakeword.nix { };
|
||||
|
||||
wyoming-piper = callPackage ../tools/audio/wyoming/piper.nix { };
|
||||
|
||||
### GAMES
|
||||
|
@ -13929,6 +13929,8 @@ self: super: with self; {
|
||||
|
||||
weboob = callPackage ../development/python-modules/weboob { };
|
||||
|
||||
webrtc-noise-gain = callPackage ../development/python-modules/webrtc-noise-gain { };
|
||||
|
||||
webrtcvad = callPackage ../development/python-modules/webrtcvad { };
|
||||
|
||||
websocket-client = callPackage ../development/python-modules/websocket-client { };
|
||||
|
Loading…
Reference in New Issue
Block a user