2024-09-05 08:48:42 -04:00
|
|
|
{
|
2024-09-01 19:19:30 -04:00
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}: let
|
2024-10-10 13:11:11 -04:00
|
|
|
inherit (lib.modules) mkForce mkIf mkOverride;
|
|
|
|
inherit (lib.strings) concatMapStringsSep concatStringsSep optionalString;
|
2024-09-01 19:19:30 -04:00
|
|
|
|
2024-09-12 18:21:31 -04:00
|
|
|
cfg = config.services.wyoming;
|
2024-09-01 19:19:30 -04:00
|
|
|
in {
|
2024-09-12 18:21:31 -04:00
|
|
|
config = let
|
|
|
|
forkedPkg = import ./pkgs/wyoming-openwakeword.nix pkgs;
|
|
|
|
in {
|
2024-12-15 10:45:06 -05:00
|
|
|
systemd.services = mkIf (cfg.openwakeword.enable) {
|
|
|
|
wyoming-openwakeword.serviceConfig = {
|
|
|
|
MemoryDenyWriteExecute = mkForce (cfg.openwakeword.package != forkedPkg);
|
2024-09-12 18:21:31 -04:00
|
|
|
|
2024-12-15 10:45:06 -05:00
|
|
|
# changes according to https://github.com/rhasspy/wyoming-openwakeword/pull/27
|
|
|
|
ExecStart = mkForce (concatStringsSep " " [
|
|
|
|
"${cfg.openwakeword.package}/bin/wyoming-openwakeword"
|
2024-09-12 18:21:31 -04:00
|
|
|
|
2024-12-15 10:45:06 -05:00
|
|
|
"--uri ${cfg.openwakeword.uri}"
|
|
|
|
"--threshold ${cfg.openwakeword.threshold}"
|
2024-09-12 18:21:31 -04:00
|
|
|
|
2024-12-15 10:45:06 -05:00
|
|
|
(concatMapStringsSep " "
|
|
|
|
(dir: "--custom-model-dir ${toString dir}")
|
|
|
|
cfg.openwakeword.customModelsDirectories)
|
2024-09-12 18:21:31 -04:00
|
|
|
|
2024-12-15 10:45:06 -05:00
|
|
|
# removed option https://github.com/rhasspy/wyoming-openwakeword/pull/27#issuecomment-2211822998
|
|
|
|
(optionalString
|
|
|
|
(cfg.openwakeword.package != forkedPkg)
|
|
|
|
(concatMapStringsSep " " (model: "--preload-model ${model}") cfg.openwakeword.preloadModels))
|
2024-09-12 18:21:31 -04:00
|
|
|
|
2024-12-15 10:45:06 -05:00
|
|
|
# removed option since preloading was removed
|
|
|
|
(optionalString
|
|
|
|
(cfg.openwakeword.package != forkedPkg)
|
|
|
|
"--trigger-level ${cfg.openwakeword.triggerLevel}")
|
2024-09-12 18:21:31 -04:00
|
|
|
|
2024-12-15 10:45:06 -05:00
|
|
|
"${cfg.openwakeword.extraArgs}"
|
|
|
|
]);
|
2024-09-01 19:19:30 -04:00
|
|
|
};
|
2024-12-15 10:45:06 -05:00
|
|
|
};
|
2024-09-12 18:21:31 -04:00
|
|
|
|
|
|
|
services.wyoming.openwakeword = mkIf (cfg.openwakeword.enable) {
|
|
|
|
package = mkOverride 900 forkedPkg;
|
2024-09-01 19:19:30 -04:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|