{ config, pkgs, lib, mkDomain, ... }:
{
  # thelunge
  # The self-hosted Web IRC client

  services.thelounge = {
    # configure user accounts by using the 'thelounge' command, or by adding entries to /var/lib/thelounge/users
    enable = true;
    public = false;
    port = 5876;
    # theLoungePlugins.themes  is view of nodePackages_latest.thelounge-theme-*
    # theLoungePlugins.plugins is view of nodePackages_latest.thelounge-plugin-*
    plugins = with pkgs.theLoungePlugins;
      (with lib; attrValues (filterAttrs (name: _: name != "recurseForDerivations") themes))
      ++ [
        #plugins.giphy
        #plugins.shortcuts
        plugins.closepms
      ];
    extraConfig.theme = "One Dark";
    extraConfig.fileUpload.enable = true;
    extraConfig.fileUpload.baseUrl = "${mkDomain "thelounge"}";
  };
  services.nginx.virtualHosts.${mkDomain "thelounge"} = lib.mkIf config.services.thelounge.enable {
    forceSSL = true; # addSSL = true;
    enableACME = true; #useACMEHost = acmeDomain;
    locations."/" = {
      proxyPass = "http://127.0.0.1:${toString config.services.thelounge.port}";
      proxyWebsockets = true;
    };
  };
}
