nixos/wyoming/openwakeword: update for 1.8.1

Remove the deprecated --models option, as models are now discovered
and loaded dynamically from all configured model dirs at runtime.

Allow setting up custom model directories, so wake words other than the
built-in ones can be used, e.g. from
https://github.com/fwartner/home-assistant-wakewords-collection.
This commit is contained in:
Martin Weinelt 2023-10-30 17:57:48 +01:00
parent 48e6ac6d4f
commit e458280606
No known key found for this signature in database
GPG key ID: 87C1E9888F856759

View file

@ -8,6 +8,7 @@ let
cfg = config.services.wyoming.openwakeword; cfg = config.services.wyoming.openwakeword;
inherit (lib) inherit (lib)
concatStringsSep
concatMapStringsSep concatMapStringsSep
escapeShellArgs escapeShellArgs
mkOption mkOption
@ -15,6 +16,7 @@ let
mkEnableOption mkEnableOption
mkIf mkIf
mkPackageOptionMD mkPackageOptionMD
mkRemovedOptionModule
types types
; ;
@ -25,6 +27,10 @@ let
in in
{ {
imports = [
(mkRemovedOptionModule [ "services" "wyoming" "openwakeword" "models" ] "Configuring models has been removed, they are now dynamically discovered and loaded at runtime")
];
meta.buildDocsInSandbox = false; meta.buildDocsInSandbox = false;
options.services.wyoming.openwakeword = with types; { options.services.wyoming.openwakeword = with types; {
@ -41,18 +47,11 @@ in
''; '';
}; };
models = mkOption { customModelsDirectories = mkOption {
type = listOf str; type = listOf types.path;
default = [ default = [];
# wyoming_openwakeword/models/*.tflite description = lib.mdDoc ''
"alexa" Paths to directories with custom wake word models (*.tflite model files).
"hey_jarvis"
"hey_mycroft"
"hey_rhasspy"
"ok_nabu"
];
description = mdDoc ''
List of wake word models that should be made available.
''; '';
}; };
@ -61,6 +60,14 @@ in
default = [ default = [
"ok_nabu" "ok_nabu"
]; ];
example = [
# wyoming_openwakeword/models/*.tflite
"alexa"
"hey_jarvis"
"hey_mycroft"
"hey_rhasspy"
"ok_nabu"
];
description = mdDoc '' description = mdDoc ''
List of wake word models to preload after startup. List of wake word models to preload after startup.
''; '';
@ -112,14 +119,15 @@ in
DynamicUser = true; DynamicUser = true;
User = "wyoming-openwakeword"; User = "wyoming-openwakeword";
# https://github.com/home-assistant/addons/blob/master/openwakeword/rootfs/etc/s6-overlay/s6-rc.d/openwakeword/run # https://github.com/home-assistant/addons/blob/master/openwakeword/rootfs/etc/s6-overlay/s6-rc.d/openwakeword/run
ExecStart = '' ExecStart = concatStringsSep " " [
${cfg.package}/bin/wyoming-openwakeword \ "${cfg.package}/bin/wyoming-openwakeword"
--uri ${cfg.uri} \ "--uri ${cfg.uri}"
${concatMapStringsSep " " (model: "--model ${model}") cfg.models} \ (concatMapStringsSep " " (model: "--preload-model ${model}") cfg.preloadModels)
${concatMapStringsSep " " (model: "--preload-model ${model}") cfg.preloadModels} \ (concatMapStringsSep " " (dir: "--custom-model-dir ${toString dir}") cfg.customModelDirectories)
--threshold ${cfg.threshold} \ "--threshold ${cfg.threshold}"
--trigger-level ${cfg.triggerLevel} ${cfg.extraArgs} "--trigger-level ${cfg.triggerLevel}"
''; "${cfg.extraArgs}"
];
CapabilityBoundingSet = ""; CapabilityBoundingSet = "";
DeviceAllow = ""; DeviceAllow = "";
DevicePolicy = "closed"; DevicePolicy = "closed";