| 1 | { pkgs, ... }: |
| 2 | let |
| 3 | domainName = "chat.nixos.org"; |
| 4 | |
| 5 | # https://github.com/element-hq/element-web/blob/develop/config.sample.json |
| 6 | elementWebConfig = { |
| 7 | default_server_config = { |
| 8 | "m.homeserver" = { |
| 9 | base_url = "https://matrix.nixos.org"; |
| 10 | server_name = "nixos.org"; |
| 11 | }; |
| 12 | "m.identity_server" = { |
| 13 | base_url = "https://vector.im"; |
| 14 | }; |
| 15 | }; |
| 16 | disable_custom_urls = false; |
| 17 | disable_guests = false; |
| 18 | disable_login_language_selector = false; |
| 19 | disable_3pid_login = false; |
| 20 | brand = "Element"; |
| 21 | integrations_ui_url = "https://scalar.vector.im/"; |
| 22 | integrations_rest_url = "https://scalar.vector.im/api"; |
| 23 | integrations_widgets_urls = [ |
| 24 | "https://scalar.vector.im/_matrix/integrations/v1" |
| 25 | "https://scalar.vector.im/api" |
| 26 | "https://scalar-staging.vector.im/_matrix/integrations/v1" |
| 27 | "https://scalar-staging.vector.im/api" |
| 28 | "https://scalar-staging.riot.im/scalar/api" |
| 29 | ]; |
| 30 | integrations_jitsi_widget_url = "https://scalar.vector.im/api/widgets/jitsi.html"; |
| 31 | bug_report_endpoint_url = "https://riot.im/bugreports/submit"; |
| 32 | default_country_code = "GB"; |
| 33 | show_labs_settings = true; |
| 34 | features = { }; |
| 35 | default_federate = true; |
| 36 | default_theme = "light"; |
| 37 | roomDirectory = { |
| 38 | servers = [ ]; |
| 39 | }; |
| 40 | settingDefaults = { |
| 41 | breadcrumbs = true; |
| 42 | }; |
| 43 | jitsi = { |
| 44 | preferred_domain = "meet.element.io"; |
| 45 | }; |
| 46 | element_call = { |
| 47 | url = "https://call.element.io"; |
| 48 | participant_limit = 8; |
| 49 | brand = "Element Call"; |
| 50 | }; |
| 51 | map_style_url = "https://api.maptiler.com/maps/streets/style.json?key=fU3vlMsMn4Jb6dnEIFsx"; |
| 52 | }; |
| 53 | in |
| 54 | { |
| 55 | security.acme.certs."${domainName}".reloadServices = [ "nginx.service" ]; |
| 56 | |
| 57 | services.nginx.virtualHosts."${domainName}" = { |
| 58 | enableACME = true; |
| 59 | forceSSL = true; |
| 60 | |
| 61 | root = pkgs.element-web.override (_old: { |
| 62 | conf = elementWebConfig; |
| 63 | }); |
| 64 | }; |
| 65 | } |