blob: 2b200bd250cf4ccc12d54faf9a4ed10000270dd5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.modules.services.element-web;
in
{
options.modules.services.element-web = {
enable = mkEnableOption "element-web";
package = mkOption { type = types.package; default = pkgs.element-web; };
hostName = mkOption { type = types.str; default = config.networking.hostName; };
matrix = {
baseUrl = mkOption { type = types.str; default = "https://matrix.${config.networking.hostName}"; };
serverName = mkOption { type = types.str; default = config.networking.hostName; };
};
tls.acmeHost = mkOption { type = types.str; default = cfg.hostName; };
jitsi.domain = mkOption { type = types.str; default = "jitsi.${cfg.hostName}"; };
};
config = mkIf cfg.enable {
services.nginx.virtualHosts.${cfg.hostName} = {
useACMEHost = cfg.tls.acmeHost;
forceSSL = true;
root = cfg.package.override {
conf = {
default_server_config = {
"m.homeserver" = {
"base_url" = cfg.matrix.baseUrl;
"server_name" = cfg.matrix.serverName;
};
"m.identity_server" = {
"base_url" = "https://vector.im";
};
};
showLabsSettings = true;
} // optionalAttrs (cfg.jitsi.domain != null) {
jitsi.preferredDomain = cfg.jitsi.domain;
};
};
locations."~ \\.(js|css|woff|woff2?|png|jpe?g|svg)$".extraConfig = ''
add_header Cache-Control "public, max-age=14400, must-revalidate";
'';
};
};
}
|