Unverified Commit 5f7f58ff authored by Martin Weinelt's avatar Martin Weinelt
Browse files
parent e48e6e0d
Loading
Loading
Loading
Loading
+23 −23
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@ let
    mkEnableOption
    mkIf
    mkPackageOption
    mkRemovedOptionModule
    types
    ;

@@ -28,8 +29,17 @@ let
in

{
  imports = [
    (mkRemovedOptionModule [
      "services"
      "wymoing"
      "openwakeword"
      "preLoadModels"
    ] "Passing a list of models to preload was removed in wyoming-openwakeword 2.0")
  ];

  options.services.wyoming.openwakeword = with types; {
    enable = mkEnableOption "Wyoming openWakeWord server";
    enable = mkEnableOption "Wyoming protocol server for openWakeWord wake word detection system";

    package = mkPackageOption pkgs "wyoming-openwakeword" { };

@@ -50,24 +60,6 @@ in
      '';
    };

    preloadModels = mkOption {
      type = listOf str;
      default = [
        "ok_nabu"
      ];
      example = [
        # wyoming_openwakeword/models/*.tflite
        "alexa"
        "hey_jarvis"
        "hey_mycroft"
        "hey_rhasspy"
        "ok_nabu"
      ];
      description = ''
        List of wake word models to preload after startup.
      '';
    };

    threshold = mkOption {
      type = numbers.between 0.0 1.0;
      default = 0.5;
@@ -91,6 +83,16 @@ in
      apply = toString;
    };

    refractorySeconds = mkOption {
      type = either int float;
      default = 2;
      example = 1.5;
      description = ''
        Duration in seconds before a wake word can be detected again.
      '';
      apply = toString;
    };

    extraArgs = mkOption {
      type = listOf str;
      default = [ ];
@@ -125,11 +127,9 @@ in
            cfg.threshold
            "--trigger-level"
            cfg.triggerLevel
            "--refractory-seconds"
            cfg.refractorySeconds
          ]
          ++ (concatMap (model: [
            "--preload-model"
            model
          ]) cfg.preloadModels)
          ++ (concatMap (dir: [
            "--custom-model-dir"
            (toString dir)
+13 −13
Original line number Diff line number Diff line
{
  lib,
  python312Packages,
  python3Packages,
  fetchFromGitHub,
  fetchpatch,
}:

let
  # tensorflow-bin unsupported on Python 3.13
  python3Packages = python312Packages;
in

python3Packages.buildPythonApplication rec {
  pname = "wyoming-openwakeword";
  version = "1.10.0";
  version = "2.0.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "rhasspy";
    repo = "wyoming-openwakeword";
    rev = "refs/tags/v${version}";
    hash = "sha256-5suYJ+Z6ofVAysoCdHi5b5K0JTYaqeFZ32Cm76wC5LU=";
    hash = "sha256-edSZ5W6oSPYLKuxjQerWRkAO/C+WeTiCosNnbS2sbh0=";
  };

  patches = [
    (fetchpatch {
      # Expose entrypoint as wyoming-openwakeword script
      url = "https://github.com/rhasspy/wyoming-openwakeword/commit/a8c8419bc65fab07a554aa0925f898a7f3b65d79.patch";
      hash = "sha256-GSViQA01RwkFYEH7CPdU1P0EQ2ml6Vp1OukQ/0VOm+Y=";
    })
  ];

  build-system = with python3Packages; [
    setuptools
  ];
@@ -29,12 +33,8 @@ python3Packages.buildPythonApplication rec {
    "wyoming"
  ];

  pythonRemoveDeps = [
    "tflite-runtime-nightly"
  ];

  dependencies = with python3Packages; [
    tensorflow-bin
    pyopen-wakeword
    wyoming
  ];