From ff6b5c753e3e8f0f56712f9ba2be5309c79d2d3d Mon Sep 17 00:00:00 2001 From: matt1432 Date: Sun, 15 Dec 2024 10:45:06 -0500 Subject: [PATCH] chore(wyoming): remove unneeded service override --- nixosModules/wyoming-plus/default.nix | 60 ++++++++++----------------- 1 file changed, 22 insertions(+), 38 deletions(-) diff --git a/nixosModules/wyoming-plus/default.nix b/nixosModules/wyoming-plus/default.nix index 48dee898..d92a7d71 100644 --- a/nixosModules/wyoming-plus/default.nix +++ b/nixosModules/wyoming-plus/default.nix @@ -4,59 +4,43 @@ pkgs, ... }: let - inherit (lib.lists) map; inherit (lib.modules) mkForce mkIf mkOverride; inherit (lib.strings) concatMapStringsSep concatStringsSep optionalString; - inherit (lib.attrsets) attrNames nameValuePair filterAttrs listToAttrs; cfg = config.services.wyoming; in { config = let forkedPkg = import ./pkgs/wyoming-openwakeword.nix pkgs; - - whisperUnitNames = attrNames ( - filterAttrs (_: v: v.device == "cpu") cfg.faster-whisper.servers - ); in { - systemd.services = - # https://github.com/felschr/nixos-config/blob/6a0f0bf76e3ae80c1e180ba6f6c7fd3b8e91d2d3/services/home-assistant/wyoming.nix#L29 - mkIf (cfg.faster-whisper.servers != {}) - (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); + systemd.services = mkIf (cfg.openwakeword.enable) { + wyoming-openwakeword.serviceConfig = { + MemoryDenyWriteExecute = mkForce (cfg.openwakeword.package != forkedPkg); - # changes according to https://github.com/rhasspy/wyoming-openwakeword/pull/27 - ExecStart = mkForce (concatStringsSep " " [ - "${cfg.openwakeword.package}/bin/wyoming-openwakeword" + # changes according to https://github.com/rhasspy/wyoming-openwakeword/pull/27 + ExecStart = mkForce (concatStringsSep " " [ + "${cfg.openwakeword.package}/bin/wyoming-openwakeword" - "--uri ${cfg.openwakeword.uri}" - "--threshold ${cfg.openwakeword.threshold}" + "--uri ${cfg.openwakeword.uri}" + "--threshold ${cfg.openwakeword.threshold}" - (concatMapStringsSep " " - (dir: "--custom-model-dir ${toString dir}") - cfg.openwakeword.customModelsDirectories) + (concatMapStringsSep " " + (dir: "--custom-model-dir ${toString dir}") + cfg.openwakeword.customModelsDirectories) - # 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)) + # 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)) - # removed option since preloading was removed - (optionalString - (cfg.openwakeword.package != forkedPkg) - "--trigger-level ${cfg.openwakeword.triggerLevel}") + # removed option since preloading was removed + (optionalString + (cfg.openwakeword.package != forkedPkg) + "--trigger-level ${cfg.openwakeword.triggerLevel}") - "${cfg.openwakeword.extraArgs}" - ]); - }; + "${cfg.openwakeword.extraArgs}" + ]); }; + }; services.wyoming.openwakeword = mkIf (cfg.openwakeword.enable) { package = mkOverride 900 forkedPkg;