diff options
author | azahi <azat@bahawi.net> | 2024-10-29 01:00:11 +0300 |
---|---|---|
committer | azahi <azat@bahawi.net> | 2024-10-29 01:00:11 +0300 |
commit | a41cd27691891e26b575c26455734851b5216488 (patch) | |
tree | c4650e568ede2a0f327e787ea921c306d3111d6b /modules/thelounge.nix | |
parent | 2024-10-28 (diff) |
Diffstat (limited to 'modules/thelounge.nix')
-rw-r--r-- | modules/thelounge.nix | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/modules/thelounge.nix b/modules/thelounge.nix new file mode 100644 index 0000000..ae4b4ff --- /dev/null +++ b/modules/thelounge.nix @@ -0,0 +1,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 = { }; + }; + }; + }; +} |