WIP: Livekit

This commit is contained in:
2026-04-30 13:22:20 +02:00
parent d46ce2d93e
commit 59907f7ece
8 changed files with 56 additions and 74 deletions
+1 -1
View File
@@ -3,7 +3,7 @@
imports = [ imports = [
./hardware-configuration.nix ./hardware-configuration.nix
../../nixos/roles/nginx.nix ../../nixos/roles/nginx.nix
../../nixos/roles/livekit.nix ../../nixos/roles/matrix/livekit.nix
../../nixos/roles/jitsi.nix ../../nixos/roles/jitsi.nix
]; ];
-68
View File
@@ -1,68 +0,0 @@
{ pkgs, ... }:
let
keyFile = "/run/livekit/livekit.key";
domain = "cyperpunk.de";
synapseUrl = "http://100.109.179.25:8008";
in
{
services = {
livekit = {
enable = true;
openFirewall = true;
inherit keyFile;
settings = {
rtc = {
tcp_port = 7881;
udp_port = 7882;
port_range_start = 50000;
port_range_end = 60000;
use_external_ip = true;
node_ip = "178.254.8.35";
};
room = {
auto_create = false;
enabled_codecs = [
{ mime = "video/VP8"; }
{ mime = "video/VP9"; }
{ mime = "video/H264"; }
{ mime = "audio/opus"; }
];
enable_remote_unmute = true;
};
};
};
lk-jwt-service = {
enable = true;
#livekitUrl = "wss://cyperpunk.de/livekit/sfu";
inherit keyFile;
livekitUrl = "wss://127.0.0.1:7880";
};
};
systemd.services = {
livekit-key = {
before = [
"lk-jwt-service.service"
"livekit.service"
];
wantedBy = [ "multi-user.target" ];
path = with pkgs; [
livekit
coreutils
gawk
];
script = ''
mkdir -p /run/livekit
echo "lk-jwt-service: $(livekit-server generate-keys | tail -1 | awk '{print $3}')" > "${keyFile}"
'';
serviceConfig.Type = "oneshot";
unitConfig.ConditionPathExists = "!${keyFile}";
};
lk-jwt-service.environment = {
LIVEKIT_FULL_ACCESS_HOMESERVERS = domain;
MATRIX_BASE_URL = synapseUrl;
};
};
}
+2 -2
View File
@@ -126,13 +126,13 @@ let
preferred_domain = "jitsi.cyperpunk.de"; preferred_domain = "jitsi.cyperpunk.de";
}; };
element_call = { element_call = {
url = "https://element.cyperpunk.de/widgets/element-call"; url = "https://element-call.cyperpunk.de";
use_exclusively = true; use_exclusively = true;
participant_limit = 8; participant_limit = 8;
brand = "Cyperpunk Call"; brand = "Cyperpunk Call";
}; };
livekit = { livekit = {
livekit_service_url = "https://cyperpunk.de/livekit/jwt"; livekit_service_url = "https://cyperpunk.de/livekit/jwt/";
}; };
setting_defaults = { setting_defaults = {
custom_themes = catppuccinThemes; custom_themes = catppuccinThemes;
+1 -1
View File
@@ -4,8 +4,8 @@
{ {
imports = [ imports = [
./synapse.nix ./synapse.nix
# ./coturn.nix
./clients.nix ./clients.nix
./lk-jwt.nix
]; ];
#networking.firewall = { #networking.firewall = {
+30
View File
@@ -0,0 +1,30 @@
{ config, ... }:
{
sops.secrets.livekit_key = { };
services.livekit = {
enable = true;
openFirewall = true;
keyFile = config.sops.secrets.livekit_key.path;
settings = {
rtc = {
tcp_port = 7881;
udp_port = 7882;
port_range_start = 50000;
port_range_end = 60000;
use_external_ip = true;
node_ip = "178.254.8.35";
};
room = {
auto_create = false;
enabled_codecs = [
{ mime = "video/VP8"; }
{ mime = "video/VP9"; }
{ mime = "video/H264"; }
{ mime = "audio/opus"; }
];
enable_remote_unmute = true;
};
};
};
}
+19
View File
@@ -0,0 +1,19 @@
{ config, ... }:
let
domain = "cyperpunk.de";
synapseUrl = "http://100.109.179.25:8008";
in
{
sops.secrets.livekit_key = { };
services.lk-jwt-service = {
enable = true;
keyFile = config.sops.secrets.livekit_key.path;
livekitUrl = "wss://cyperpunk.de/livekit/sfu";
};
systemd.services.lk-jwt-service.environment = {
LIVEKIT_FULL_ACCESS_HOMESERVERS = domain;
MATRIX_BASE_URL = synapseUrl;
};
}
+1
View File
@@ -49,6 +49,7 @@
names = [ names = [
"client" "client"
"federation" "federation"
"openid"
]; ];
compress = false; compress = false;
} }
+2 -2
View File
@@ -41,7 +41,7 @@ let
"org.matrix.msc4143.rtc_foci":[ "org.matrix.msc4143.rtc_foci":[
{ {
"type":"livekit", "type":"livekit",
"livekit_service_url":"https://cyperpunk.de/livekit/jwt" "livekit_service_url":"https://cyperpunk.de/livekit/jwt/"
} }
] ]
}'; }';
@@ -116,7 +116,7 @@ in
}; };
"^~ /livekit/jwt/" = { "^~ /livekit/jwt/" = {
priority = 400; priority = 400;
proxyPass = "http://127.0.0.1:8080/"; proxyPass = "http://${upstream}:8080/";
}; };
"^~ /livekit/sfu/" = { "^~ /livekit/sfu/" = {
priority = 400; priority = 400;