fixed tts service

This commit is contained in:
Ingolf Wagner 2023-08-25 09:32:16 +02:00
parent 199e1fe563
commit 167c0b9958
No known key found for this signature in database
GPG key ID: 76BF5F1928B9618B

View file

@ -3,22 +3,52 @@
, ... , ...
}: { }: {
systemd.services.tts = { #systemd.services.tts = {
after = [ "network.target" ]; # after = [ "network.target" ];
wantedBy = [ "multi-user.target" ]; # wantedBy = [ "multi-user.target" ];
path = [ pkgs.espeak ]; # path = [ pkgs.espeak ];
environment.HOME = "/var/lib/tts"; # environment.HOME = "/var/lib/tts";
serviceConfig = { # serviceConfig = {
StateDirectory = "tts"; # CapabilityBoundingSet = "";
DynamicUser = true; # DeviceAllow = "";
User = "tts"; # DevicePolicy = "closed";
Group = "tts"; # LockPersonality = true;
ExecStart = '' # # jit via numba->llvmpipe
${pkgs.tts}/bin/tts-server --model_name tts_models/en/ljspeech/vits --port 5004 # 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
# '';
# };
#};
# find models with ${pkgs.tts}/bin/tts --list_models
services.tts = { services.tts = {
servers = { servers = {
english = { english = {
@ -35,19 +65,26 @@
}; };
}; };
}; };
# fixes some issues
systemd.services.tts-german.serviceConfig.RestrictAddressFamilies = [
"AF_UNIX"
];
systemd.services.tts-english.serviceConfig.RestrictAddressFamilies = [
"AF_UNIX"
];
services.nginx = { services.nginx = {
recommendedProxySettings = true; recommendedProxySettings = true;
enable = true; enable = true;
# works
virtualHosts."tts.${config.networking.hostName}.private" = { virtualHosts."tts.${config.networking.hostName}.private" = {
locations."/".proxyPass = "http://localhost:5004"; locations."/".proxyPass = "http://localhost:${toString config.services.tts.servers.english.port}";
}; };
# works not
virtualHosts."en.tts.${config.networking.hostName}.private" = { virtualHosts."en.tts.${config.networking.hostName}.private" = {
locations."/".proxyPass = "http://localhost:${toString config.services.tts.servers.english.port}"; locations."/".proxyPass = "http://localhost:${toString config.services.tts.servers.english.port}";
}; };
# works
virtualHosts."de.tts.${config.networking.hostName}.private" = { virtualHosts."de.tts.${config.networking.hostName}.private" = {
locations."/".proxyPass = "http://localhost:${toString config.services.tts.servers.german.port}"; locations."/".proxyPass = "http://localhost:${toString config.services.tts.servers.german.port}";
}; };