Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add voice option to home-assistant #236

Merged
merged 4 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/auto-merge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- uses: reitermarkus/automerge@v2
with:
token: ${{ secrets.GH_TOKEN_FOR_UPDATES }}
merge-method: squash
merge-method: rebase
do-not-merge-labels: never-merge
required-labels: automerge
pull-request: ${{ github.event.inputs.pull-request }}
Expand Down
9 changes: 9 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@
};
pkgs = import patchedNixpkgs {
inherit system;

config = {
permittedInsecurePackages = [
# https://github.com/NixOS/nixpkgs/issues/360592
"aspnetcore-runtime-6.0.36"
# TODO: https://github.com/NixOS/nixpkgs/issues/326335
"dotnet-sdk-6.0.428"
];
};
};

allModules = [
Expand Down
40 changes: 40 additions & 0 deletions modules/services/home-assistant.nix
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,42 @@ in
};
};

voice = lib.mkOption {
description = "Options related to voice service.";
default = {};
type = lib.types.submodule {
options = {
speech-to-text = lib.mkOption {
description = ''
Wyoming piper servers.

https://search.nixos.org/options?channel=23.11&from=0&size=50&sort=relevance&type=packages&query=services.wyoming.piper.servers
'';
type = lib.types.attrsOf lib.types.anything;
default = {};
};
text-to-speech = lib.mkOption {
description = ''
Wyoming faster-whisper servers.

https://search.nixos.org/options?channel=23.11&from=0&size=50&sort=relevance&type=packages&query=services.wyoming.faster-whisper.servers
'';
type = lib.types.attrsOf lib.types.anything;
default = {};
};
wakeword = lib.mkOption {
description = ''
Wyoming open wakework servers.

https://search.nixos.org/options?channel=23.11&from=0&size=50&sort=relevance&type=packages&query=services.wyoming.openwakeword
'';
type = lib.types.anything;
default = { enable = false; };
};
};
};
};

backup = lib.mkOption {
description = ''
Backup configuration.
Expand Down Expand Up @@ -267,6 +303,10 @@ in
};
};

services.wyoming.piper.servers = cfg.voice.text-to-speech;
services.wyoming.faster-whisper.servers = cfg.voice.speech-to-text;
services.wyoming.openwakeword = cfg.voice.wakeword;

services.nginx.virtualHosts."${fqdn}" = {
http2 = true;

Expand Down
5 changes: 5 additions & 0 deletions modules/services/nextcloud-server.nix
Original file line number Diff line number Diff line change
Expand Up @@ -739,6 +739,11 @@ in
];
systemd.timers.nextcloud-cron.requires = cfg.mountPointServices;
systemd.timers.nextcloud-cron.after = cfg.mountPointServices;
# This is needed to be able to run the cron job before opening the app for the first time.
# Otherwise the cron job fails while searching for this directory.
systemd.services.nextcloud-setup.script = ''
mkdir -p ${cfg.dataDir}/data/appdata_$(${occ} config:system:get instanceid)/theming/global
'';

systemd.services.nextcloud-setup.requires = cfg.mountPointServices;
systemd.services.nextcloud-setup.after = cfg.mountPointServices;
Expand Down
60 changes: 60 additions & 0 deletions test/services/home-assistant.nix
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,50 @@ let
# };
# };
# };

voice = {
shb.home-assistant.voice.text-to-speech = {
"fr" = {
enable = true;
voice = "fr-siwis-medium";
uri = "tcp://0.0.0.0:10200";
speaker = 0;
};
"en" = {
enable = true;
voice = "en_GB-alba-medium";
uri = "tcp://0.0.0.0:10201";
speaker = 0;
};
};
shb.home-assistant.voice.speech-to-text = {
"tiny-fr" = {
enable = true;
model = "base-int8";
language = "fr";
uri = "tcp://0.0.0.0:10300";
device = "cpu";
};
"tiny-en" = {
enable = true;
model = "base-int8";
language = "en";
uri = "tcp://0.0.0.0:10301";
device = "cpu";
};
};
shb.home-assistant.voice.wakeword = {
enable = true;
uri = "tcp://127.0.0.1:10400";
preloadModels = [
"alexa"
"hey_jarvis"
"hey_mycroft"
"hey_rhasspy"
"ok_nabu"
];
};
};
in
{
basic = pkgs.testers.runNixOSTest {
Expand Down Expand Up @@ -151,4 +195,20 @@ in
#
# testScript = commonTestScript.access;
# };

voice = pkgs.testers.runNixOSTest {
name = "homeassistant_ldap";

nodes.server = {
imports = [
base
basic
voice
];
};

nodes.client = {};

testScript = commonTestScript.access;
};
}
6 changes: 5 additions & 1 deletion test/services/nextcloud.nix
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,14 @@ let
port = config.shb.ldap.ldapPort;
dcdomain = config.shb.ldap.dcdomain;
adminName = "admin";
adminPassword.result = config.shb.ldap.ldapUserPassword.result;
adminPassword.result = config.shb.hardcodedsecret.nextcloudLdapUserPassword.result;
userGroup = "nextcloud_user";
};
};
shb.hardcodedsecret.nextcloudLdapUserPassword = {
request = config.shb.nextcloud.apps.ldap.adminPassword.request;
settings = config.shb.hardcodedsecret.ldapUserPassword.settings;
};
};

sso = { config, ... }:
Expand Down
Loading