]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - modules/private/websites/tools/tools/grocy.nix
Remove webappdirs
[perso/Immae/Config/Nix.git] / modules / private / websites / tools / tools / grocy.nix
CommitLineData
c7627e14
IB
1{ lib, stdenv, grocy }:
2rec {
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" ];
750fe5a4 19 root = webRoot;
5400b9b6 20 vhostConf = socket: ''
c7627e14
IB
21 Alias /grocy "${root}"
22 <Directory "${root}">
23 DirectoryIndex index.php
24 <FilesMatch "\.php$">
5400b9b6 25 SetHandler "proxy:unix:${socket}|fcgi://localhost"
c7627e14
IB
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 ]);
5400b9b6
IB
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";
c7627e14 43
5400b9b6
IB
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 };
c7627e14
IB
49 };
50}
51