1{
2 config,
3 lib,
4 pkgs,
5 ...
6}:
7{
8 name = "livekit";
9 meta.maintainers = [ lib.maintainers.quadradical ];
10
11 nodes.machine = {
12 services.livekit = {
13 enable = true;
14 keyFile = pkgs.writers.writeYAML "keys.yaml" {
15 key = "f6lQGaHtM5HfgZjIcec3cOCRfiDqIine4CpZZnqdT5cE";
16 };
17 settings.port = 8000;
18 };
19
20 specialisation.ingress = {
21 inheritParentConfig = true;
22 configuration = {
23 services.livekit = {
24 ingress.enable = true;
25 redis.port = 6379;
26 };
27 };
28 };
29 };
30
31 testScript = ''
32 with subtest("Test livekit service"):
33 machine.wait_for_unit("livekit.service")
34 machine.wait_for_open_port(8000)
35 machine.succeed("curl 127.0.0.1:8000 -L --fail")
36
37 with subtest("Test locally distributed livekit service with ingress component"):
38 machine.succeed("${config.nodes.machine.system.build.toplevel}/specialisation/ingress/bin/switch-to-configuration test")
39 machine.wait_for_unit("livekit-ingress.service")
40 machine.wait_for_open_port(8080)
41 machine.log(machine.succeed("curl --fail -X OPTIONS 127.0.0.1:8080/whip/test"))
42 '';
43}