element call done

This commit is contained in:
Henry Hiles 2025-04-18 00:53:02 -04:00
parent 8f0c07c950
commit c160964c18
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs
6 changed files with 42 additions and 44 deletions

View file

@ -3,11 +3,13 @@
config, config,
... ...
}: { }: {
services = { services = let
domain = "call.henryhiles.com";
in {
lk-jwt-service = { lk-jwt-service = {
enable = true; enable = true;
livekit = { livekit = {
url = "wss://call.henryhiles.com/livekit/sfu"; url = "wss://${domain}/livekit/sfu";
keyFile = config.age.secrets."livekitKeys.age".path; keyFile = config.age.secrets."livekitKeys.age".path;
}; };
}; };
@ -17,7 +19,7 @@
keyFile = config.age.secrets."livekitKeys.age".path; keyFile = config.age.secrets."livekitKeys.age".path;
}; };
caddy.virtualHosts."call.henryhiles.com".extraConfig = '' caddy.virtualHosts."${domain}".extraConfig = ''
root * ${pkgs.element-call} root * ${pkgs.element-call}
route { route {
respond /config.json `${builtins.toJSON { respond /config.json `${builtins.toJSON {
@ -27,7 +29,7 @@
"server_name" = "henryhiles.com"; "server_name" = "henryhiles.com";
}; };
}; };
livekit.livekit_service_url = "https://call.henryhiles.com/livekit"; livekit.livekit_service_url = "https://${domain}/livekit";
}}` 200 }}` 200
handle /livekit/sfu/get { handle /livekit/sfu/get {

View file

@ -1,6 +1,6 @@
{ {
services = let services = let
domain = "vaultwarden.henryhiles.com"; domain = "vault.henryhiles.com";
in { in {
vaultwarden = { vaultwarden = {
enable = true; enable = true;

View file

@ -6,14 +6,17 @@
}: let }: let
cfg = config.services.livekit; cfg = config.services.livekit;
in { in {
meta.maintainers = [lib.maintainers.quadradical]; meta.maintainers = with lib.maintainers; [quadradical];
options.services.livekit = { options.services.livekit = {
enable = lib.mkEnableOption "Livekit SFU"; enable = lib.mkEnableOption "Enable the livekit server";
package = lib.mkPackageOption pkgs "livekit" {}; package = lib.mkPackageOption pkgs "livekit" {};
keyFile = lib.mkOption { keyFile = lib.mkOption {
type = lib.types.path; type = lib.types.path;
description = "LiveKit key file, with syntax `LIVEKIT_KEYS=\"key: secret\"`;"; description = ''
LiveKit key file, with syntax `LIVEKIT_KEYS=\"key: secret\"`
The key and secret are used by other clients or services to connect to your Livekit instance.
'';
}; };
openFirewall = lib.mkOption { openFirewall = lib.mkOption {
@ -75,7 +78,6 @@ in {
serviceConfig = { serviceConfig = {
EnvironmentFile = cfg.keyFile; EnvironmentFile = cfg.keyFile;
DynamicUser = true; DynamicUser = true;
User = "livekit";
LockPersonality = true; LockPersonality = true;
MemoryDenyWriteExecute = true; MemoryDenyWriteExecute = true;
ProtectClock = true; ProtectClock = true;
@ -101,18 +103,18 @@ in {
"~@privileged" "~@privileged"
"~@resources" "~@resources"
]; ];
CapabilityBoundingSet = [ ExecStart = "${lib.getExe cfg.package} --config-body=${
"CAP_NET_BIND_SERVICE" builtins.toJSON (
"CAP_NET_RAW" builtins.toJSON {
]; port = cfg.port;
ExecStart = "${cfg.package}/bin/livekit-server --config-body=${builtins.toJSON (builtins.toJSON { rtc = {
port = cfg.port; port_range_start = cfg.rtc.portRangeStart;
rtc = { port_range_end = cfg.rtc.portRangeEnd;
port_range_start = cfg.rtc.portRangeStart; use_external_ip = cfg.useExternalIP;
port_range_end = cfg.rtc.portRangeEnd; };
use_external_ip = cfg.useExternalIP; }
}; )
})}"; }";
Restart = "on-failure"; Restart = "on-failure";
RestartSec = 5; RestartSec = 5;
UMask = "077"; UMask = "077";

View file

@ -14,14 +14,17 @@ in {
livekit = { livekit = {
url = lib.mkOption { url = lib.mkOption {
type = lib.types.str; type = lib.types.str;
description = "The URL that livekit runs on, prefixed with `ws://` or `wss://` (recommended)."; description = ''
The URL that livekit runs on, prefixed with `ws://` or `wss://` (recommended).
For example, `wss://example.com/livekit/sfu`
'';
}; };
keyFile = lib.mkOption { keyFile = lib.mkOption {
type = lib.types.path; type = lib.types.path;
description = '' description = ''
Path to a file showing LiveKit keys, where you must declare some of: `LIVEKIT_KEY`, `LIVEKIT_SECRET`, `LIVEKIT_KEY_FROM_FILE`, `LIVEKIT_SECRET_FROM_FILE`, and/or `LIVEKIT_KEY_FILE`. Path to a file showing LiveKit keys, where you must declare some of: `LIVEKIT_KEY`, `LIVEKIT_SECRET`, `LIVEKIT_KEY_FROM_FILE`, `LIVEKIT_SECRET_FROM_FILE`, and/or `LIVEKIT_KEY_FILE`.
For more information see <https://github.com/element-hq/lk-jwt-service>. For more information, see <https://github.com/element-hq/lk-jwt-service#configuration>.
''; '';
}; };
}; };
@ -29,7 +32,7 @@ in {
port = lib.mkOption { port = lib.mkOption {
type = lib.types.port; type = lib.types.port;
default = 8080; default = 8080;
description = "Port that lk-jwt-service should run on"; description = "Port that lk-jwt-service should listen on.";
}; };
}; };
@ -45,7 +48,6 @@ in {
serviceConfig = { serviceConfig = {
EnvironmentFile = cfg.livekit.keyFile; EnvironmentFile = cfg.livekit.keyFile;
DynamicUser = true; DynamicUser = true;
User = "lk-jwt-service";
LockPersonality = true; LockPersonality = true;
MemoryDenyWriteExecute = true; MemoryDenyWriteExecute = true;
ProtectClock = true; ProtectClock = true;
@ -70,11 +72,7 @@ in {
"~@privileged" "~@privileged"
"~@resources" "~@resources"
]; ];
CapabilityBoundingSet = [ ExecStart = lib.getExe cfg.package;
"CAP_NET_BIND_SERVICE"
"CAP_NET_RAW"
];
ExecStart = "${cfg.package}/bin/lk-jwt-service";
Restart = "on-failure"; Restart = "on-failure";
RestartSec = 5; RestartSec = 5;
UMask = "077"; UMask = "077";

View file

@ -1,11 +1,12 @@
-----BEGIN AGE ENCRYPTED FILE----- -----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IHNzaC1lZDI1NTE5IFZLUVVkUSB0QU8r YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IHNzaC1lZDI1NTE5IFZLUVVkUSBEb3hG
VGtZaWU4cjBOaG8ya2ZoalFrb053MjQxS2ttajgwRDdVay8vVDM0CnpaenVhNVJh al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/v1
-> ssh-ed25519 VKQUdQ HLH8VPiSrQCLCA6jDDNgRwGxmBYx/tp29Ofk+lASR20
61DZpjUfqtSWg76RqZ4dQZMkLh3Z9/AXIshdnAZL2Os
--- NtZ+33l6WGz+UMzSLxqLVATi2fdk60CDdWm9X71sqm4
À§X±É*è²=}ź ìd%­ªÅgCÀ”¬Ÿîs2eœN3dYž¥åÐŽW7C¦~ltI<74>D_Köðp[ªªyÓÿÁ§Ðé|6É€m˜`F±tŸR0<52>¶ð