Change ec modules
This commit is contained in:
parent
c160964c18
commit
1d46cb69fc
4 changed files with 42 additions and 35 deletions
|
@ -10,13 +10,13 @@
|
||||||
enable = true;
|
enable = true;
|
||||||
livekit = {
|
livekit = {
|
||||||
url = "wss://${domain}/livekit/sfu";
|
url = "wss://${domain}/livekit/sfu";
|
||||||
keyFile = config.age.secrets."livekitKeys.age".path;
|
environmentFile = config.age.secrets."livekitKeys.age".path;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
livekit = {
|
livekit = {
|
||||||
enable = true;
|
enable = true;
|
||||||
keyFile = config.age.secrets."livekitKeys.age".path;
|
environmentFile = config.age.secrets."livekitKeys.age".path;
|
||||||
};
|
};
|
||||||
|
|
||||||
caddy.virtualHosts."${domain}".extraConfig = ''
|
caddy.virtualHosts."${domain}".extraConfig = ''
|
||||||
|
|
|
@ -11,7 +11,10 @@
|
||||||
settings = {
|
settings = {
|
||||||
server_name = "henryhiles.com";
|
server_name = "henryhiles.com";
|
||||||
database.backend = "rocksdb";
|
database.backend = "rocksdb";
|
||||||
federation.max_concurrent_requests = 10000;
|
federation = {
|
||||||
|
max_concurrent_requests = 10000;
|
||||||
|
self_test = false;
|
||||||
|
};
|
||||||
|
|
||||||
server_discovery = {
|
server_discovery = {
|
||||||
server.authority = "${domain}:443";
|
server.authority = "${domain}:443";
|
||||||
|
|
|
@ -5,13 +5,14 @@
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
cfg = config.services.livekit;
|
cfg = config.services.livekit;
|
||||||
|
format = pkgs.formats.json {};
|
||||||
in {
|
in {
|
||||||
meta.maintainers = with lib.maintainers; [quadradical];
|
meta.maintainers = with lib.maintainers; [quadradical];
|
||||||
options.services.livekit = {
|
options.services.livekit = {
|
||||||
enable = lib.mkEnableOption "Enable the livekit server";
|
enable = lib.mkEnableOption "Enable the livekit server";
|
||||||
package = lib.mkPackageOption pkgs "livekit" {};
|
package = lib.mkPackageOption pkgs "livekit" {};
|
||||||
|
|
||||||
keyFile = lib.mkOption {
|
environmentFile = lib.mkOption {
|
||||||
type = lib.types.path;
|
type = lib.types.path;
|
||||||
description = ''
|
description = ''
|
||||||
LiveKit key file, with syntax `LIVEKIT_KEYS=\"key: secret\"`
|
LiveKit key file, with syntax `LIVEKIT_KEYS=\"key: secret\"`
|
||||||
|
@ -34,24 +35,38 @@ in {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
port = lib.mkOption {
|
settings = lib.mkOption {
|
||||||
type = lib.types.port;
|
type = lib.types.submodule {
|
||||||
default = 7880;
|
freeformType = format.type;
|
||||||
description = "Main TCP port for RoomService and RTC endpoint.";
|
options = {
|
||||||
};
|
port = lib.mkOption {
|
||||||
|
type = lib.types.port;
|
||||||
|
default = 7880;
|
||||||
|
description = "Main TCP port for RoomService and RTC endpoint.";
|
||||||
|
};
|
||||||
|
|
||||||
rtc = {
|
rtc = {
|
||||||
portRangeStart = lib.mkOption {
|
port_range_start = lib.mkOption {
|
||||||
type = lib.types.int;
|
type = lib.types.int;
|
||||||
default = 50000;
|
default = 50000;
|
||||||
description = "Start of UDP port range for WebRTC";
|
description = "Start of UDP port range for WebRTC";
|
||||||
};
|
};
|
||||||
|
|
||||||
portRangeEnd = lib.mkOption {
|
port_range_end = lib.mkOption {
|
||||||
type = lib.types.int;
|
type = lib.types.int;
|
||||||
default = 51000;
|
default = 51000;
|
||||||
description = "End of UDP port range for WebRTC";
|
description = "End of UDP port range for WebRTC";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
default = {};
|
||||||
|
description = ''
|
||||||
|
LiveKit configuration file expressed in nix.
|
||||||
|
|
||||||
|
For an example configuration, see <https://docs.livekit.io/home/self-hosting/deployment/#configuration>.
|
||||||
|
For all possible values, see <https://github.com/livekit/livekit/blob/master/config-sample.yaml>.
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -76,7 +91,7 @@ in {
|
||||||
after = ["network-online.target"];
|
after = ["network-online.target"];
|
||||||
|
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
EnvironmentFile = cfg.keyFile;
|
EnvironmentFile = cfg.environmentFile;
|
||||||
DynamicUser = true;
|
DynamicUser = true;
|
||||||
LockPersonality = true;
|
LockPersonality = true;
|
||||||
MemoryDenyWriteExecute = true;
|
MemoryDenyWriteExecute = true;
|
||||||
|
@ -103,18 +118,7 @@ in {
|
||||||
"~@privileged"
|
"~@privileged"
|
||||||
"~@resources"
|
"~@resources"
|
||||||
];
|
];
|
||||||
ExecStart = "${lib.getExe cfg.package} --config-body=${
|
ExecStart = "${lib.getExe cfg.package} --config ${format.generate "livekit.json" cfg.settings}";
|
||||||
builtins.toJSON (
|
|
||||||
builtins.toJSON {
|
|
||||||
port = cfg.port;
|
|
||||||
rtc = {
|
|
||||||
port_range_start = cfg.rtc.portRangeStart;
|
|
||||||
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";
|
||||||
|
|
|
@ -20,10 +20,10 @@ in {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
keyFile = lib.mkOption {
|
environmentFile = 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 of environment variables, 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#configuration>.
|
For more information, see <https://github.com/element-hq/lk-jwt-service#configuration>.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
@ -46,7 +46,7 @@ in {
|
||||||
environment.LIVEKIT_URL = cfg.livekit.url;
|
environment.LIVEKIT_URL = cfg.livekit.url;
|
||||||
|
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
EnvironmentFile = cfg.livekit.keyFile;
|
EnvironmentFile = cfg.livekit.environmentFile;
|
||||||
DynamicUser = true;
|
DynamicUser = true;
|
||||||
LockPersonality = true;
|
LockPersonality = true;
|
||||||
MemoryDenyWriteExecute = true;
|
MemoryDenyWriteExecute = true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue