blob: 92a292706c812e4f70d3cb7662a23f87c1e6d37c (
plain) (
blame)
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
{
config,
lib,
pkgs,
...
}:
with lib;
let
cfg = config.nixfiles.modules.matrix.element;
in
{
options.nixfiles.modules.matrix.element = {
enable = mkEnableOption "Element, a Matrix web interface";
domain = mkOption {
description = "Domain name sans protocol scheme.";
type = with types; nullOr str;
default = "element.${config.networking.domain}";
};
homeserver = mkOption {
description = "Default Matrix homeserver.";
type = with types; str;
default = my.domain.azahi;
};
};
config = mkIf cfg.enable {
assertions = [
{
assertion =
with config.nixfiles.modules.matrix;
(synapse.enable || dendrite.enable) && !(!synapse.enable && !dendrite.enable);
message = "Synapse or Dendrite must be enabled";
}
];
nixfiles.modules.nginx = with cfg; {
enable = true;
virtualHosts.${domain}.locations."/".root = pkgs.element-web.override {
conf = {
default_server_config."m.homeserver" = {
base_url = "https://${homeserver}";
server_name = homeserver;
};
disable_custom_urls = true;
disable_guests = true;
disable_login_language_selector = true;
disable_3pid_login = true;
brand = homeserver;
branding.authFooterLinks = [
{
text = "Hosted on NixOS";
url = "https://nixos.org";
}
];
default_theme = "dark";
};
};
};
};
}
|