]> git.immae.eu Git - perso/Immae/Config/Nix.git/blob - systems/eldiron/websites/im/default.nix
Squash changes containing private information
[perso/Immae/Config/Nix.git] / systems / eldiron / websites / im / default.nix
1 { config, lib, pkgs, ... }:
2 let
3 cfg = config.myServices.websites.tools.im;
4 converseVersion = "9.1.1";
5 www = pkgs.runCommand "www" {} ''
6 cp -a ${./www} $out
7 substituteInPlace $out/converse.html --replace {{converseVersion}} ${converseVersion}
8 '';
9 in
10 {
11 options.myServices.websites.tools.im = {
12 enable = lib.mkEnableOption "enable im website";
13 };
14
15 config = lib.mkIf cfg.enable {
16 myServices.chatonsProperties.services.converse = {
17 file.datetime = "2022-08-21T19:20:00";
18 service = {
19 name = "Converse";
20 description = "A free and open-source XMPP chat client in your browser";
21 website = "https://im.immae.fr/converse";
22 logo = "https://conversejs.org/docs/html/_static/favicon.ico";
23 status.level = "OK";
24 status.description = "OK";
25 registration."" = ["NONE" "FREE"];
26 registration.load = "OPEN";
27 install.type = "PACKAGE";
28 };
29 software = {
30 name = "Converse";
31 website = "https://conversejs.org/";
32 license.name = "Mozilla Public License 2.0";
33 license.url = "https://github.com/conversejs/converse.js/blob/master/LICENSE";
34 version = "9.1.1";
35 source.url = "https://github.com/conversejs/converse.js";
36 };
37 };
38 myServices.chatonsProperties.services.weechat-bridge = {
39 file.datetime = "2022-08-21T19:20:00";
40 service = {
41 name = "Weechat bridge";
42 description = "WeeChat web frontend";
43 website = "https://im.immae.fr/glowing-bear";
44 logo = "https://im.immae.fr/glowing-bear/assets/img/glowing_bear_128x128.png";
45 status.level = "OK";
46 status.description = "OK";
47 registration."" = ["NONE" "FREE"];
48 registration.load = "OPEN";
49 install.type = "PACKAGE";
50 };
51 software = {
52 name = "Glowing bear";
53 website = "https://www.ejabberd.im/";
54 license.name = "GNU General Public License v3.0";
55 license.url = "https://github.com/processone/ejabberd";
56 version = pkgs.glowing-bear.version;
57 source.url = "https://github.com/glowing-bear/glowing-bear";
58 };
59 };
60 myServices.chatonsProperties.services.xmpp = {
61 file.datetime = "2022-08-21T19:20:00";
62 service = {
63 name = "XMPP";
64 description = "Universal messaging standard";
65 website = "https://im.immae.fr/";
66 logo = "https://xmpp.org/favicon-32x32.png";
67 status.level = "OK";
68 status.description = "OK";
69 registration."" = ["MEMBER" "CLIENT"];
70 registration.load = "OPEN";
71 install.type = "PACKAGE";
72 };
73 software = {
74 name = "ejabberd";
75 website = "https://www.ejabberd.im/";
76 license.url = "https://github.com/processone/ejabberd/blob/master/COPYING";
77 license.name = "GNU GENERAL PUBLIC LICENSE Version 2";
78 version = pkgs.ejabberd.version;
79 source.url = "https://github.com/processone/ejabberd";
80 modules = "converse";
81 };
82 };
83 security.acme.certs.eldiron.extraDomainNames = [ "im.immae.fr" ];
84 services.websites.env.tools.vhostConfs.im = {
85 certName = "eldiron";
86 hosts = ["im.immae.fr"];
87 root = www;
88 extraConfig = [
89 ''
90 Alias /glowing-bear ${pkgs.glowing-bear}
91 Alias /converse ${www}/converse.html
92 ProxyPreserveHost On
93 <Location "/bosh">
94 ProxyPass http://localhost:5280/bosh
95 ProxyPassReverse http://localhost:5280/bosh
96 </Location>
97 <Location "/ws">
98 ProxyPass ws://localhost:5280/ws
99 </Location>
100 ProxyPass /upload http://localhost:5280/upload
101 ProxyPassReverse /upload http://localhost:5280/upload
102 ProxyPass /admin http://localhost:5280/admin
103 ProxyPassReverse /admin http://localhost:5280/admin
104 ProxyPass /api http://localhost:5280/api
105 ProxyPassReverse /api http://localhost:5280/api
106 <Directory ${pkgs.glowing-bear}>
107 AllowOverride none
108 Require all granted
109 </Directory>
110 <Directory ${www}>
111 Require all granted
112 AllowOverride none
113 </Directory>
114 ''
115 ];
116 };
117 };
118 }