-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathautogenstudio.nix
More file actions
72 lines (67 loc) · 2.26 KB
/
autogenstudio.nix
File metadata and controls
72 lines (67 loc) · 2.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
{ config, pkgs, lib, ... }:
{
systemd.services.autogenstudio = {
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
serviceConfig = {
ExecStart = ''${(pkgs.python313Packages.callPackage ../pkgs/python/autogen-studio.nix {})}/bin/autogenstudio ui --workers 2 --appdir /var/lib/autogenstudio --port 8081'';
DynamicUser = true;
Restart = "on-failure";
StateDirectory = "autogenstudio";
ReadWritePaths = ["/var/lib/autogenstudio"];
WorkingDirectory = "/var/lib/autogenstudio";
# Hardening
CapabilityBoundingSet = "";
DeviceAllow = [];
DevicePolicy = "closed";
LockPersonality = true;
MemoryDenyWriteExecute = false;
NoNewPrivileges = true;
PrivateDevices = false;
PrivateUsers = true;
PrivateTmp = true;
ProtectClock = true;
ProtectControlGroups = true;
ProtectHome = true;
ProtectHostname = true;
ProtectKernelLogs = true;
ProtectKernelModules = true;
ProtectKernelTunables = true;
ProtectProc = "invisible";
ProcSubset = "pid";
ProtectSystem = "strict";
RemoveIPC = true;
RestrictAddressFamilies = [
"AF_INET"
"AF_INET6"
];
RestrictNamespaces = true;
RestrictRealtime = true;
RestrictSUIDSGID = true;
SupplementaryGroups = [];
SystemCallArchitectures = "native";
UMask = "0077";
};
};
services.nginx.virtualHosts."autogen.nathan.gs" = {
forceSSL = true;
enableACME = true;
extraConfig = ''
proxy_buffering off;
'';
basicAuth = config.secrets.nginx.basicAuth;
locations."/" = {
proxyPass = "http://127.0.0.1:8081";
proxyWebsockets = true; # needed if you need to use WebSocket
extraConfig = ''
# required when the target is also TLS server with multiple hosts
proxy_ssl_server_name on;
# required when the server wants to use HTTP Authentication
proxy_pass_header Authorization;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
'';
};
};
}