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