File tree Expand file tree Collapse file tree 1 file changed +27
-10
lines changed Expand file tree Collapse file tree 1 file changed +27
-10
lines changed Original file line number Diff line number Diff line change 1414 ] ;
1515
1616 CC = "clang" ;
17- QEMU_NET_OPTS = "hostfwd=tcp:127.0.0.1 :8080-:8080 " ;
17+ QEMU_NET_OPTS = "hostfwd=tcp::8080-:80 " ;
1818 } ;
1919
2020 packages . x86_64-linux . display =
3131
3232 nixosModules . everything =
3333 { config , ... } : {
34- networking . firewall . allowedTCPPorts = [ 8080 ] ;
34+ networking . firewall . allowedTCPPorts = [ 80 ] ;
3535 systemd . services . ttds-runner = {
36- wantedBy = [ "multi-user.target" ] ;
37- after = [ "network.target" ] ;
38- description = "Run the ttds web server, wrapping the display server." ;
39-
36+ wantedBy = [ "multi-user.target" ] ;
37+ after = [ "network.target" ] ;
38+ description = "Run the ttds web server, wrapping the display server." ;
4039 serviceConfig = {
41- ExecStart = "${ self . packages . x86_64-linux . web } /bin/ttds-web ${ self . packages . x86_64-linux . display } /bin/ttds" ;
42- WorkingDirectory = "/etc" ;
43- } ;
44- } ;
40+ ExecStart = "${ self . packages . x86_64-linux . web } /bin/ttds-web ${ self . packages . x86_64-linux . display } /bin/ttds" ;
41+ WorkingDirectory = "/etc" ;
42+ } ;
43+ } ;
44+
45+ services . nginx . enable = true ;
46+ services . nginx . config = ''
47+ events {}
48+
49+ http {
50+ limit_req_zone $binary_remote_addr zone=api:10m rate=20r/s;
51+
52+ server {
53+ listen 80;
54+
55+ location / {
56+ limit_req zone=api burst=50 nodelay;
57+ proxy_pass http://localhost:8080/;
58+ }
59+ }
60+ }
61+ '' ;
4562 } ;
4663
4764 nixosConfigurations . test-vm = nixpkgs . lib . nixosSystem {
You can’t perform that action at this time.
0 commit comments