{ config, pkgs, lib, mkDomain, ... }:

lib.mkIf pkgs.unstable.cinny.meta.available # no CVE's thank you

{
  # Cinny
  # Yet another Matrix client for the web

  services.nginx.virtualHosts.${mkDomain "cinny"} = {
    forceSSL = true; # addSSL = true;
    enableACME = true; #useACMEHost = acmeDomain;
    # TODO: the override causes a rebuild which fails on low-RAM systems
    root = pkgs.unstable.cinny.override {
      conf = {
        defaultHomeserver = 0;
        homeserverList = [
          "pvv.ntnu.no"
          "matrix.org"
        ];
      };
    };
  };

}
