blob: ae4b4ff15d9e1943650abd5d127b9eceb4bbf2ea (
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
|
{
config,
lib,
libNginx,
...
}:
let
cfg = config.nixfiles.modules.thelounge;
in
{
options.nixfiles.modules.thelounge = {
enable = lib.mkEnableOption "The Lounge";
port = lib.mkOption {
description = "Port.";
type = lib.types.port;
default = 11887;
};
domain = lib.mkOption {
description = "Domain name sans protocol scheme.";
type = lib.types.str;
default = "irc.${config.networking.domain}";
};
};
config = lib.mkIf cfg.enable {
ark.directories = [ "/var/lib/thelounge" ];
nixfiles.modules.nginx = {
upstreams.thelounge.servers."127.0.0.1:${toString cfg.port}" = { };
virtualHosts.${cfg.domain} = {
locations."/".proxyPass = "http://thelounge";
extraConfig = libNginx.config.internalOnly;
};
};
services.thelounge = {
enable = true;
extraConfig = {
public = false;
host = "127.0.0.1";
inherit (cfg) port;
reverseProxy = true;
defaults = { };
};
};
};
}
|