{ config, pkgs, lib, mkDomain, ... }:
{
  # Element-web
  # A glossy Matrix collaboration client for the web

  services.nginx.virtualHosts.${mkDomain "element"} = {
    forceSSL = true; # addSSL = true;
    enableACME = true; #useACMEHost = acmeDomain;
    root = pkgs.element-web.override {
      conf = {
        # https://github.com/vector-im/element-web/blob/develop/docs/config.md
        # https://github.com/vector-im/element-web/blob/develop/config.sample.json
        # https://github.com/vector-im/element-web/blob/develop/docs/labs.md
        brand = "spis meg";
        default_country_code = "NO";
        default_server_config."m.homeserver" = {
          server_name = "pvv.ntnu.no";
          base_url = "https://matrix.pvv.ntnu.no";
        };
        roomDirectory.servers = [
          "pvv.ntnu.no"
          "matrix.org"
          "nixos.org"
          "agdersam.no"
          "trygve.me"
          "utwente.io"
        ];
        disable_guests = true;
        showLabsSettings = true;
        features.feature_pinning = "labs";
        features.feature_custom_status = "labs";
        features.feature_custom_tags = "labs";
        features.feature_state_counters = "labs";
        features.feature_latex_maths = "labs";
        setting_defaults.breadcrumbs = true;
        UIFeature.urlPreviews = true;
        UIFeature.shareQrCode = true;
        UIFeature.registration = false;
      };
    };
  };

}
