]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - modules/private/websites/tools/mail/rainloop.nix
Upgrade nixos
[perso/Immae/Config/Nix.git] / modules / private / websites / tools / mail / rainloop.nix
CommitLineData
46f30ecc
IB
1{ lib, pkgs, writeText, stdenv, fetchurl }:
2rec {
3 varDir = "/var/lib/rainloop";
4 activationScript = {
5 deps = [ "wrappers" ];
6 text = ''
7 install -m 0755 -o ${apache.user} -g ${apache.group} -d ${varDir}
8 install -m 0750 -o ${apache.user} -g ${apache.group} -d ${varDir}/phpSessions
9 install -m 0750 -o ${apache.user} -g ${apache.group} -d ${varDir}/data
10 '';
11 };
7f9bc878 12 webRoot = pkgs.rainloop-community.override { dataPath = "${varDir}/data"; };
46f30ecc
IB
13 apache = rec {
14 user = "wwwrun";
15 group = "wwwrun";
16 modules = [ "proxy_fcgi" ];
17 webappName = "tools_rainloop";
18 root = "/run/current-system/webapps/${webappName}";
5400b9b6 19 vhostConf = socket: ''
46f30ecc
IB
20 Alias /rainloop "${root}"
21 <Directory "${root}">
22 DirectoryIndex index.php
23 AllowOverride All
24 Options -FollowSymlinks
25 Require all granted
26
27 <FilesMatch "\.php$">
5400b9b6 28 SetHandler "proxy:unix:${socket}|fcgi://localhost"
46f30ecc
IB
29 </FilesMatch>
30 </Directory>
31
32 <DirectoryMatch "${root}/data">
33 Require all denied
34 </DirectoryMatch>
35 '';
36 };
37 phpFpm = rec {
a840a21c 38 serviceDeps = [ "postgresql.service" ];
46f30ecc 39 basedir = builtins.concatStringsSep ":" [ webRoot varDir ];
5400b9b6
IB
40 pool = {
41 "listen.owner" = apache.user;
42 "listen.group" = apache.group;
43 "pm" = "ondemand";
44 "pm.max_children" = "60";
45 "pm.process_idle_timeout" = "60";
46f30ecc 46
5400b9b6
IB
47 # Needed to avoid clashes in browser cookies (same domain)
48 "php_value[session.name]" = "RainloopPHPSESSID";
49 "php_admin_value[upload_max_filesize]" = "200M";
50 "php_admin_value[post_max_size]" = "200M";
51 "php_admin_value[open_basedir]" = "${basedir}:/tmp";
52 "php_admin_value[session.save_path]" = "${varDir}/phpSessions";
53 };
46f30ecc
IB
54 };
55}