Hello fellow Nixers. I’m excited to share my project: yo, a flake-based voice assistant for NixOS.
yo makes it easy to set up a voice assistant and define your own voice-driven scripts.
Since the intent data and fuzzy index are precompiled at build time - this will outperform any other voice assistant, and still give user full control.
Let’s write a declarative voice command!
Give the script a name and a description.
yo.scripts.<name>.description = "script description"
Give the script parameters.
yo.scripts.<name>.parameters = [
{
name = "state";
type = "string";
description = "State of the device or room";
}
And define the voice sentences and entity lists.
yo.scripts.<name>.voice = {
enabled = true;
priority = 2;
sentences = [
"turn {state} the light in {room}"
];
lists = {
state.values = [
{ "in" = "[on|activate]"; out = "ON"; }
{ "in" = "off"; out = "OFF"; }
];
};
And finally write the code for the script.
yo.scripts.<name>.code = ''
echo "Turning $state the device: $device"
'';
And there you go! Simple as that - you just wrote your first voice command.
Activate the server service
services.yo-rs.server.enable = true;
Your going to need a microphone as well - activate the client:
services.yo-rs.client.enable = true;
That’s it! Your all set!
It’s a quite extensive project, check out the project GitHub for source code and example usage.
I know this is quite niche - but would love to hear your thoughts.
Stay safe!