]> git.immae.eu Git - perso/Immae/Config/Nix.git/blob - modules/private/websites/tools/commento/default.nix
Add chatons infos
[perso/Immae/Config/Nix.git] / modules / private / websites / tools / commento / default.nix
1 { lib, pkgs, config, ... }:
2 let
3 cfg = config.myServices.websites.tools.commento;
4 env = config.myEnv.tools.commento;
5 webPort = "${host}:${port}";
6 port = toString env.listenPort;
7 host = "localhost";
8 postgresql_url = "postgres://${env.postgresql.user}:${env.postgresql.password}@localhost:${env.postgresql.port}/${env.postgresql.database}?sslmode=disable";
9 in
10 {
11 options.myServices.websites.tools.commento = {
12 enable = lib.mkEnableOption "Enable commento website";
13 };
14 config = lib.mkIf cfg.enable {
15 myServices.chatonsProperties.services.commento = {
16 file.datetime = "2022-08-21T01:11:00";
17 service = {
18 name = "Commento";
19 description = "Commento is a fast, privacy-focused commenting platform";
20 website = "https://commento.immae.eu";
21 logo = "https://commento.immae.eu/images/logo.svg";
22 status.level = "OK";
23 status.description = "OK";
24 registration."" = ["MEMBER" "CLIENT"];
25 registration.load = "OPEN";
26 install.type = "PACKAGE";
27 };
28 software = {
29 name = "Commento";
30 website = "https://www.commento.io/";
31 license.url = "https://gitlab.com/commento/commento/-/blob/master/LICENSE";
32 license.name = "MIT License";
33 version = pkgs.commento.version;
34 source.url = "https://gitlab.com/commento/commento";
35 };
36 };
37 secrets.keys = {
38 "commento/env" = {
39 permissions = "0400";
40 text = ''
41 COMMENTO_ORIGIN=https://commento.immae.eu/
42 COMMENTO_PORT=${port}
43 COMMENTO_POSTGRES=${postgresql_url}
44 COMMENTO_FORBID_NEW_OWNERS=true
45 COMMENTO_BIND_ADDRESS=${host}
46 COMMENTO_GZIP_STATIC=true
47 COMMENTO_SMTP_HOST=${env.smtp.host}
48 COMMENTO_SMTP_PORT=${env.smtp.port}
49 COMMENTO_SMTP_USERNAME=${env.smtp.email}
50 COMMENTO_SMTP_PASSWORD=${env.smtp.password}
51 COMMENTO_SMTP_FROM_ADDRESS=${env.smtp.email}
52 '';
53 };
54 };
55
56 services.websites.env.tools.vhostConfs.commento = {
57 certName = "eldiron";
58 addToCerts = true;
59 hosts = [ "commento.immae.eu" ];
60 root = null;
61 extraConfig = [
62 ''
63 ProxyPass / http://${webPort}/
64 ProxyPassReverse / http://${webPort}/
65 ProxyPreserveHost On
66 ''
67 ];
68 };
69 systemd.services.commento = {
70 description = "Commento";
71 wantedBy = [ "multi-user.target" ];
72 requires = ["postgresql.service"];
73 after = ["network.target" "postgresql.service"];
74 serviceConfig = {
75 User = "wwwrun";
76 ExecStart = "${pkgs.commento}/commento";
77 EnvironmentFile = config.secrets.fullPaths."commento/env";
78 };
79 };
80 };
81 }