]> git.immae.eu Git - perso/Immae/Config/Nix.git/blob - modules/private/websites/tools/tools/grocy.nix
Remove webappdirs
[perso/Immae/Config/Nix.git] / modules / private / websites / tools / tools / grocy.nix
1 { lib, stdenv, grocy }:
2 rec {
3 backups = {
4 rootDir = varDir;
5 };
6 varDir = "/var/lib/grocy";
7 activationScript = {
8 deps = [ "wrappers" ];
9 text = ''
10 install -m 0755 -o ${apache.user} -g ${apache.group} -d ${varDir}/data
11 install -m 0750 -o ${apache.user} -g ${apache.group} -d ${varDir}/phpSessions
12 '';
13 };
14 webRoot = grocy.webRoot;
15 apache = rec {
16 user = "wwwrun";
17 group = "wwwrun";
18 modules = [ "proxy_fcgi" ];
19 root = webRoot;
20 vhostConf = socket: ''
21 Alias /grocy "${root}"
22 <Directory "${root}">
23 DirectoryIndex index.php
24 <FilesMatch "\.php$">
25 SetHandler "proxy:unix:${socket}|fcgi://localhost"
26 </FilesMatch>
27
28 AllowOverride All
29 Options +FollowSymlinks
30 Require all granted
31 </Directory>
32 '';
33 };
34 phpFpm = rec {
35 basedir = builtins.concatStringsSep ":" (
36 [ grocy grocy.yarnModules varDir ]);
37 pool = {
38 "listen.owner" = apache.user;
39 "listen.group" = apache.group;
40 "pm" = "ondemand";
41 "pm.max_children" = "60";
42 "pm.process_idle_timeout" = "60";
43
44 # Needed to avoid clashes in browser cookies (same domain)
45 "php_value[session.name]" = "grocyPHPSESSID";
46 "php_admin_value[open_basedir]" = "${basedir}:/tmp";
47 "php_admin_value[session.save_path]" = "${varDir}/phpSessions";
48 };
49 };
50 }
51