summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/home/rhasspy/default.nix
blob: e3a0bcd28d29678af4ebcaf753a56f3b3a60f6f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
{ lib,config, ... }:
# uses alsa instead of pulseaduio server
let
  profiles = "/var/lib/rhasspy";
in
{
  systemd.services.docker-rhasspy.after = [ "network-online.target" ];

  virtualisation.oci-containers.containers.rhasspy = {
    image = "rhasspy/rhasspy:latest";

    environment = {
      TZ = "Europe/Berlin";
      PULSE_SERVER = "tcp:${ config.krebs.build.host.name }:4713";
    };

    ports = [ 
      "12101:12101" 
    ];

    volumes = [
      "/etc/localtime:/etc/localtime:ro"
      "${profiles}:/profiles"
    ];

    cmd = [ "--user-profiles" "/profiles" "--profile" "de" ];
    extraOptions = [ 
      "--device=/dev/snd:/dev/snd"
      "--group-add=audio" 
    ];
  };
  systemd.tmpfiles.rules = [
    "d ${profiles} 0770 root root - -"
  ];

  # required to allow rhasspy to connect to pulse server
  # hardware.pulseaudio.enable = lib.mkForce false;
  networking.firewall.allowedTCPPorts = [ 4713 ];

}