This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

superconfig / 2configs / nixcon-quiz.nix
1.4 kB 38 lines
1let 2 domain = "quiz.lassul.us"; 3 port = 8773; 4in 5{ self, ... }: 6{ 7 # nixcon-quiz: live multiplayer quiz for NixCon. Everyone answers the same 8 # question against the same server clock; /spectate is the 16:9 screen for 9 # the livestream with a QR code to join. 10 # 11 # The questions are not part of any repository (whoever reads them knows 12 # every answer) and stay out of the world-readable store. Copy them over 13 # after deploying; until then the service is skipped: 14 # rsync -r --delete ~/src/nixcon-quiz/questions/ root@neoprism.r:/var/lib/nixcon-quiz/questions/ 15 # ssh root@neoprism.r systemctl restart nixcon-quiz 16 imports = [ self.inputs.nixcon-quiz.nixosModules.default ]; 17 18 services.nixcon-quiz = { 19 enable = true; 20 host = "127.0.0.1"; 21 inherit port domain; 22 questionSeconds = 40; 23 }; 24 25 # One address may hold a few tabs (players and a spectator screen) and 26 # reload at a human pace; each tab keeps one event stream open. 27 services.nginx.appendHttpConfig = '' 28 limit_conn_zone $binary_remote_addr zone=nixcon_quiz_conns:10m; 29 limit_req_zone $binary_remote_addr zone=nixcon_quiz_joins:10m rate=5r/s; 30 ''; 31 32 services.nginx.virtualHosts.${domain}.locations."/api/events".extraConfig = '' 33 limit_conn nixcon_quiz_conns 16; 34 limit_req zone=nixcon_quiz_joins burst=30 nodelay; 35 limit_conn_status 429; 36 limit_req_status 429; 37 ''; 38}