2BGCCK64WA7SVJ2KLNVT6OHSW7MGRPUF4ZVRTSQWJ55RC652D2BQC O5U2RS6S4RUGVSOZPTJGD6HJOOO5VM7SPZUDUHU4G3BHZOTJH47QC RTBMBSBABSGTRICJ4AWBKWO3JJHBRKV6FGOMYPDD7X6SS6X35ZIQC SUJ7TKWXHFZCEEQFGLRT4PZ4TYAXFLNDZVE57SN2AHXTLEPX7WXAC 4GGQX4QFLTB4FMCYJOIBPOAMZVC5FXUNEZGF3A7E7GUNNVM5WQHAC 4R56PJDQPYZ5FLFAMZSNY7UI5TKF6N5YCHCJU3ZBV5FHB46GYM5QC XPKDQGFUFF4BT32ODPEJRZGBEOGZVDRAEN2EOWU7DBIN2QQX6KUAC { self, config, lib, pkgs, ... }: letinherit (config.networking) domain;fqdn = "chat.${domain}";in {imports = [ (self + /modules/nginx.nix) ];services.nginx.virtualHosts.${fqdn} = lib.merge config.services.nginx.sslTemplate {root = pkgs.element-web;locations."= /config.json".extraConfig = ''default_type application/json;return 200 '${builtins.toJSON {default_server_config."m.homeserver" = {base_url = "https://matrix.${domain}";server_name = domain;};brand = "chat.plumj.am";disable_3pid_login = true;disable_login_language_selector = true;disable_guests = true;bug_report_endpoint_url = null;show_labs_settings = true;features = {feature_pinning = "labs";feature_custom_status = "labs";feature_custom_tags = "labs";feature_state_counters = "labs";};default_federate = true;default_theme = "light";room_directory.servers = [ domain "matrix.org" ];enable_presence_by_hs_url = {"https://matrix.org" = false;"https://matrix-client.matrix.org" = false;};setting_defaults.breadcrumbs = true;}}';'';# spa routing serves index.html for all routeslocations."/".tryFiles = "$uri $uri/ /index.html";# static assets cachinglocations."~* \\.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$".extraConfig = ''expires 1y;'';};}
{ self, config, lib, pkgs, ... }: letinherit (config.networking) domain;inherit (lib) merge;inherit (lib.strings) toJSON;fqdn = "chat.${domain}";root = pkgs.cinny;cinnyConfig = {allowCustomHomeservers = false;homeserverList = [ domain ];defaultHomeserver = 0;hashRouter = {enabled = false;basename = "/";};featuredCommunities = {openAsDefault = false;servers = [ domain ];spaces = [ ];rooms = [ ];};};in {imports = [ (self + /modules/nginx.nix) ];services.nginx.virtualHosts.${fqdn} = merge config.services.nginx.sslTemplate {inherit root;locations."= /config.json".extraConfig = /* nginx */ ''default_type application/json;return 200 '${toJSON cinnyConfig}';'';extraConfig = /* nginx */ ''rewrite ^/config.json$ /config.json break;rewrite ^/manifest.json$ /manifest.json break;rewrite ^/sw.js$ /sw.js break;rewrite ^/pdf.worker.min.js$ /pdf.worker.min.js break;rewrite ^/public/(.*)$ /public/$1 break;rewrite ^/assets/(.*)$ /assets/$1 break;rewrite ^(.+)$ /index.html break;'';};}