The Perfect Voice Assistant is a NixOS Module

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!

15 Likes

Intentions to upstream?

I might be open for that.

This is neat! You might want to mention that the STT part is handled by (if I’m reading the repo correctly) the Whisper family of models.

Oh yes you are correct.

Speech to text uses GGML.bin models and ONNX based models are being used for text to speech responses and wake word detection.

1 Like

I created a smart watch, that let’s me run my Nix voice commands on- the-go!
Deploying hosts from your wrist – anytime/anywhere.

Repository has videos showcasing usage.

6 Likes

This looks like a great project! I wanto to achieve something similar. I will start by studying your stuff and see if I can contribute here instead of starting some new thing.

Hey, @QuackHack-McBlindy . I am trying to reproduce your stuff today. I ran into some expeted blocker for such a young and big package. I will be sending some issues into your repo as I run into things I believe deserve to be mentioned.

Thanks! Any help I get is appreciated.