chore(wyoming): remove unneeded service override
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-12-15 10:45:06 -05:00
parent a33fc66b15
commit ff6b5c753e

View file

@ -4,59 +4,43 @@
pkgs, pkgs,
... ...
}: let }: let
inherit (lib.lists) map;
inherit (lib.modules) mkForce mkIf mkOverride; inherit (lib.modules) mkForce mkIf mkOverride;
inherit (lib.strings) concatMapStringsSep concatStringsSep optionalString; inherit (lib.strings) concatMapStringsSep concatStringsSep optionalString;
inherit (lib.attrsets) attrNames nameValuePair filterAttrs listToAttrs;
cfg = config.services.wyoming; cfg = config.services.wyoming;
in { in {
config = let config = let
forkedPkg = import ./pkgs/wyoming-openwakeword.nix pkgs; forkedPkg = import ./pkgs/wyoming-openwakeword.nix pkgs;
whisperUnitNames = attrNames (
filterAttrs (_: v: v.device == "cpu") cfg.faster-whisper.servers
);
in { in {
systemd.services = systemd.services = mkIf (cfg.openwakeword.enable) {
# https://github.com/felschr/nixos-config/blob/6a0f0bf76e3ae80c1e180ba6f6c7fd3b8e91d2d3/services/home-assistant/wyoming.nix#L29 wyoming-openwakeword.serviceConfig = {
mkIf (cfg.faster-whisper.servers != {}) MemoryDenyWriteExecute = mkForce (cfg.openwakeword.package != forkedPkg);
(listToAttrs (map (x:
nameValuePair "wyoming-faster-whisper-${x}" {
serviceConfig.ProcSubset = mkForce "all";
})
whisperUnitNames))
#
# openWakeWord
// mkIf (cfg.openwakeword.enable) {
wyoming-openwakeword.serviceConfig = {
MemoryDenyWriteExecute = mkForce (cfg.openwakeword.package != forkedPkg);
# changes according to https://github.com/rhasspy/wyoming-openwakeword/pull/27 # changes according to https://github.com/rhasspy/wyoming-openwakeword/pull/27
ExecStart = mkForce (concatStringsSep " " [ ExecStart = mkForce (concatStringsSep " " [
"${cfg.openwakeword.package}/bin/wyoming-openwakeword" "${cfg.openwakeword.package}/bin/wyoming-openwakeword"
"--uri ${cfg.openwakeword.uri}" "--uri ${cfg.openwakeword.uri}"
"--threshold ${cfg.openwakeword.threshold}" "--threshold ${cfg.openwakeword.threshold}"
(concatMapStringsSep " " (concatMapStringsSep " "
(dir: "--custom-model-dir ${toString dir}") (dir: "--custom-model-dir ${toString dir}")
cfg.openwakeword.customModelsDirectories) cfg.openwakeword.customModelsDirectories)
# removed option https://github.com/rhasspy/wyoming-openwakeword/pull/27#issuecomment-2211822998 # removed option https://github.com/rhasspy/wyoming-openwakeword/pull/27#issuecomment-2211822998
(optionalString (optionalString
(cfg.openwakeword.package != forkedPkg) (cfg.openwakeword.package != forkedPkg)
(concatMapStringsSep " " (model: "--preload-model ${model}") cfg.openwakeword.preloadModels)) (concatMapStringsSep " " (model: "--preload-model ${model}") cfg.openwakeword.preloadModels))
# removed option since preloading was removed # removed option since preloading was removed
(optionalString (optionalString
(cfg.openwakeword.package != forkedPkg) (cfg.openwakeword.package != forkedPkg)
"--trigger-level ${cfg.openwakeword.triggerLevel}") "--trigger-level ${cfg.openwakeword.triggerLevel}")
"${cfg.openwakeword.extraArgs}" "${cfg.openwakeword.extraArgs}"
]); ]);
};
}; };
};
services.wyoming.openwakeword = mkIf (cfg.openwakeword.enable) { services.wyoming.openwakeword = mkIf (cfg.openwakeword.enable) {
package = mkOverride 900 forkedPkg; package = mkOverride 900 forkedPkg;