WIP
This commit is contained in:
1 parent
13e407847f
commit
374428658a
80 files changed
+2517
-1058
No files matched your search
@@ -0,0 +1,33 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
common = config.selfhosted.common;
|
||||
cfg = config.selfhosted.mirotalk;
|
||||
in
|
||||
{
|
||||
imports = [ ./server ];
|
||||
|
||||
options.selfhosted.mirotalk = {
|
||||
enable = mkEnableOption "Enable ${cfg.targetName} root target";
|
||||
targetName = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
sops.secrets = {
|
||||
"mirotalk/client_secret" = { };
|
||||
"mirotalk/session_secret" = { };
|
||||
"mirotalk/api_key_secret" = { };
|
||||
};
|
||||
|
||||
systemd.targets."${common.backend}-${cfg.targetName}" = {
|
||||
unitConfig = {
|
||||
Description = "Root target for ${cfg.targetName}";
|
||||
};
|
||||
wantedBy = [ "${common.backend}-${common.rootTarget.name}.target" ];
|
||||
partOf = [ "${common.backend}-${common.rootTarget.name}.target" ];
|
||||
after = [ "${common.backend}-${common.rootTarget.name}.target" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
rootCfg = config.selfhosted.mirotalk;
|
||||
cfg = rootCfg.server;
|
||||
domain = "${config.sops.placeholder."domains/serv"}";
|
||||
pocketIdSubdomain = config.selfhosted.pocket-id.subdomain;
|
||||
publicUrl = "https://${cfg.subdomain}.${domain}";
|
||||
stunUrl = "stun:${config.selfhosted.netbird.subdomain}.${domain}:3478";
|
||||
in
|
||||
{
|
||||
config = mkIf rootCfg.enable {
|
||||
sops.templates."mirotalk.env".content = ''
|
||||
NODE_ENV=production
|
||||
TZ=${config.time.timeZone}
|
||||
PORT=3000
|
||||
TRUST_PROXY=true
|
||||
|
||||
OIDC_ENABLED=true
|
||||
OIDC_ALLOW_ROOMS_CREATION_FOR_AUTH_USERS=true
|
||||
OIDC_BASE_URL_DYNAMIC=false
|
||||
OIDC_ISSUER_BASE_URL=https://${pocketIdSubdomain}.${domain}
|
||||
OIDC_BASE_URL=${publicUrl}
|
||||
OIDC_CLIENT_ID=mirotalk
|
||||
OIDC_CLIENT_SECRET=${config.sops.placeholder."mirotalk/client_secret"}
|
||||
OIDC_AUTH_REQUIRED=false
|
||||
OIDC_AUTH_LOGOUT=true
|
||||
SESSION_SECRET=${config.sops.placeholder."mirotalk/session_secret"}
|
||||
|
||||
HOST_PROTECTED=true
|
||||
HOST_USER_AUTH=false
|
||||
HOST_USERS='[]'
|
||||
|
||||
API_KEY_SECRET=${config.sops.placeholder."mirotalk/api_key_secret"}
|
||||
|
||||
STUN_SERVER_ENABLED=true
|
||||
STUN_SERVER_URL=${stunUrl}
|
||||
TURN_SERVER_ENABLED=false
|
||||
|
||||
STATS_ENABLED=false
|
||||
SURVEY_ENABLED=false
|
||||
'';
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
common = config.selfhosted.common;
|
||||
rootCfg = config.selfhosted.mirotalk;
|
||||
cfg = rootCfg.server;
|
||||
in
|
||||
{
|
||||
imports = [ ./config.nix ];
|
||||
|
||||
options.selfhosted.mirotalk.server = {
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
subdomain = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
hostHttpPort = mkOption {
|
||||
type = types.port;
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf rootCfg.enable {
|
||||
virtualisation.oci-containers.containers."${cfg.name}" = {
|
||||
# Docker Hub only publishes `latest`; this digest is MiroTalk P2P 1.9.39 (2026-09-03).
|
||||
image = "docker.io/mirotalk/p2p@sha256:c05675e2e3e8a2bb1ee63f07dcaaf8523a30b4dee4d1e594594ff5e36c959b07";
|
||||
ports = [
|
||||
"0.0.0.0:${toString cfg.hostHttpPort}:3000"
|
||||
];
|
||||
user = "${common.user.uid}:${common.group.gid}";
|
||||
environmentFiles = [ config.sops.templates."mirotalk.env".path ];
|
||||
volumes = [
|
||||
"${config.sops.templates."mirotalk.env".path}:/src/.env:ro"
|
||||
];
|
||||
log-driver = "journald";
|
||||
extraOptions = [
|
||||
"--network=${common.network.name}"
|
||||
];
|
||||
};
|
||||
|
||||
systemd.services."${common.backend}-${cfg.name}" = {
|
||||
serviceConfig = {
|
||||
Restart = lib.mkOverride 90 "always";
|
||||
};
|
||||
wantedBy = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user