nixos-config/nixos/machines/chungus/tts.nix

93 lines
2.5 KiB
Nix
Raw Normal View History

2023-06-21 08:34:43 +02:00
{ pkgs
, config
, ...
}: {
2023-08-25 09:32:16 +02:00
#systemd.services.tts = {
# after = [ "network.target" ];
# wantedBy = [ "multi-user.target" ];
# path = [ pkgs.espeak ];
# environment.HOME = "/var/lib/tts";
# serviceConfig = {
# CapabilityBoundingSet = "";
# DeviceAllow = "";
# DevicePolicy = "closed";
# LockPersonality = true;
# # jit via numba->llvmpipe
# MemoryDenyWriteExecute = false;
# PrivateDevices = true;
# PrivateUsers = true;
# ProtectHome = true;
# ProtectHostname = true;
# ProtectKernelLogs = true;
# ProtectKernelModules = true;
# ProtectKernelTunables = true;
# ProtectControlGroups = true;
# ProtectProc = "invisible";
# ProcSubset = "pid";
# RestrictAddressFamilies = [
# "AF_UNIX"
# "AF_INET"
# "AF_INET6"
# ];
# RestrictRealtime = true;
# RestrictNamespaces = true;
# SystemCallArchitectures = "native";
# SystemCallFilter = [
# "@system-service"
# "~@privileged"
# ];
# UMask = "0077";
# StateDirectory = "tts";
# DynamicUser = true;
# User = "tts";
# Group = "tts";
# ExecStart = ''
# ${pkgs.tts}/bin/tts-server --model_name tts_models/en/ljspeech/vits --port 5004
# '';
# };
#};
2023-06-21 08:34:43 +02:00
2023-08-25 09:32:16 +02:00
# find models with ${pkgs.tts}/bin/tts --list_models
2023-08-24 14:25:59 +02:00
services.tts = {
servers = {
english = {
enable = true;
port = 5300;
#model = "tts_models/en/ljspeech/tacotron2-DDC";
model = "tts_models/en/ljspeech/vits";
};
german = {
enable = true;
port = 5301;
#model = "tts_models/de/thorsten/tacotron2-DDC";
model = "tts_models/de/thorsten/vits";
};
};
};
2023-08-25 09:32:16 +02:00
# fixes some issues
systemd.services.tts-german.serviceConfig.RestrictAddressFamilies = [
"AF_UNIX"
];
systemd.services.tts-english.serviceConfig.RestrictAddressFamilies = [
"AF_UNIX"
];
2023-08-24 14:25:59 +02:00
2023-06-21 08:34:43 +02:00
services.nginx = {
recommendedProxySettings = true;
enable = true;
virtualHosts."tts.${config.networking.hostName}.private" = {
2023-08-25 09:32:16 +02:00
locations."/".proxyPass = "http://localhost:${toString config.services.tts.servers.english.port}";
2023-06-21 08:34:43 +02:00
};
2023-08-24 14:25:59 +02:00
virtualHosts."en.tts.${config.networking.hostName}.private" = {
locations."/".proxyPass = "http://localhost:${toString config.services.tts.servers.english.port}";
};
virtualHosts."de.tts.${config.networking.hostName}.private" = {
locations."/".proxyPass = "http://localhost:${toString config.services.tts.servers.german.port}";
};
2023-06-21 08:34:43 +02:00
};
}