add translate
This commit is contained in:
parent
e0cd2a7940
commit
e7ab4a2172
3 changed files with 55 additions and 0 deletions
|
@ -39,6 +39,8 @@
|
||||||
./services/spacebar.nix
|
./services/spacebar.nix
|
||||||
./services/rgit.nix
|
./services/rgit.nix
|
||||||
|
|
||||||
|
./services/translate.nix
|
||||||
|
|
||||||
noshell.nixosModules.default
|
noshell.nixosModules.default
|
||||||
{programs.noshell.enable = true;}
|
{programs.noshell.enable = true;}
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,11 @@
|
||||||
domain = "spacebar-api.mtgmonkey.net";
|
domain = "spacebar-api.mtgmonkey.net";
|
||||||
proxyTo = "http://localhost:3001/";
|
proxyTo = "http://localhost:3001/";
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
domain = "translate.mtgmonkey.net";
|
||||||
|
proxyTo = "http://localhost:9109/"
|
||||||
|
}
|
||||||
|
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
|
|
48
services/translate.nix
Executable file
48
services/translate.nix
Executable file
|
@ -0,0 +1,48 @@
|
||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
botPolicies-nix = {
|
||||||
|
dnsbl = false;
|
||||||
|
status_codes = {
|
||||||
|
CHALLENGE = 200;
|
||||||
|
DENY = 200;
|
||||||
|
};
|
||||||
|
bots = [
|
||||||
|
{
|
||||||
|
name = "catch-everything";
|
||||||
|
user_agent_regex = ".*";
|
||||||
|
action = "CHALLENGE";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
services.anubis = {
|
||||||
|
instances.translate = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
BIND = "[::1]:9109";
|
||||||
|
BIND_NETWORK = "tcp";
|
||||||
|
DIFFICULTY = 4;
|
||||||
|
METRICS_BIND = "[::1]:9119";
|
||||||
|
METRICS_BIND_NETWORK = "tcp";
|
||||||
|
POLICY_FNAME = "/etc/anubis/elmskell.botPolicies.yaml";
|
||||||
|
TARGET = "http://localhost:8108";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
environment.etc."anubis/translate.botPolicies.yaml" = {
|
||||||
|
source = (pkgs.formats.yaml {}).generate "" botPolicies-nix;
|
||||||
|
mode = "644";
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.services.translate = {
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "simple";
|
||||||
|
ExecStart = "${lib.getExe pkgs.libretranslate}";
|
||||||
|
RemainAfterExit = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue