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.8 kB 48 lines
1let 2 domain = "quiz.nixcon.org"; 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 # Break slides for /spectate (PDF/PNG/JPEG/WebP, not in any repository 17 # either) are picked up without a restart: 18 # rsync -r --delete ~/src/nixcon-quiz/slides/ root@neoprism.r:/var/lib/nixcon-quiz/slides/ 19 imports = [ self.inputs.nixcon-quiz.nixosModules.default ]; 20 21 services.nixcon-quiz = { 22 enable = true; 23 host = "127.0.0.1"; 24 inherit port domain; 25 questionSeconds = 20; 26 }; 27 28 # One address may hold a few tabs (players and a spectator screen) and 29 # reload at a human pace; each tab keeps one event stream open. 30 services.nginx.appendHttpConfig = '' 31 limit_conn_zone $binary_remote_addr zone=nixcon_quiz_conns:10m; 32 limit_req_zone $binary_remote_addr zone=nixcon_quiz_joins:10m rate=5r/s; 33 ''; 34 35 services.nginx.virtualHosts.${domain}.locations."/api/events".extraConfig = '' 36 limit_conn nixcon_quiz_conns 16; 37 limit_req zone=nixcon_quiz_joins burst=30 nodelay; 38 limit_conn_status 429; 39 limit_req_status 429; 40 ''; 41 42 # The quiz's first home; old links and QR codes land on the new name. 43 services.nginx.virtualHosts."quiz.lassul.us" = { 44 enableACME = true; 45 forceSSL = true; 46 globalRedirect = domain; 47 }; 48}