1 { lib, pkgs, config, ... }:
3 cfg = config.myServices.websites.tools.commento;
4 env = config.myEnv.tools.commento;
5 webPort = "${host}:${port}";
6 port = toString env.listenPort;
8 postgresql_url = "postgres://${env.postgresql.user}:${env.postgresql.password}@localhost:${env.postgresql.port}/${env.postgresql.database}?sslmode=disable";
11 options.myServices.websites.tools.commento = {
12 enable = lib.mkEnableOption "Enable commento website";
14 config = lib.mkIf cfg.enable {
17 dest = "commento/env";
20 COMMENTO_ORIGIN=https://commento.immae.eu/
22 COMMENTO_POSTGRES=${postgresql_url}
23 COMMENTO_FORBID_NEW_OWNERS=true
24 COMMENTO_BIND_ADDRESS=${host}
25 COMMENTO_GZIP_STATIC=true
26 COMMENTO_SMTP_HOST=${env.smtp.host}
27 COMMENTO_SMTP_PORT=${env.smtp.port}
28 COMMENTO_SMTP_USERNAME=${env.smtp.email}
29 COMMENTO_SMTP_PASSWORD=${env.smtp.password}
30 COMMENTO_SMTP_FROM_ADDRESS=${env.smtp.email}
35 services.websites.env.tools.vhostConfs.commento = {
38 hosts = [ "commento.immae.eu" ];
42 ProxyPass / http://${webPort}/
43 ProxyPassReverse / http://${webPort}/
48 systemd.services.commento = {
49 description = "Commento";
50 wantedBy = [ "multi-user.target" ];
51 requires = ["postgresql.service"];
52 after = ["network.target" "postgresql.service"];
55 ExecStart = "${pkgs.commento}/commento";
56 EnvironmentFile = config.secrets.fullPaths."commento/env";