aboutsummaryrefslogtreecommitdiff
path: root/systems/eldiron/websites/tools/grocy.nix
diff options
context:
space:
mode:
Diffstat (limited to 'systems/eldiron/websites/tools/grocy.nix')
-rw-r--r--systems/eldiron/websites/tools/grocy.nix48
1 files changed, 48 insertions, 0 deletions
diff --git a/systems/eldiron/websites/tools/grocy.nix b/systems/eldiron/websites/tools/grocy.nix
new file mode 100644
index 0000000..96e18a3
--- /dev/null
+++ b/systems/eldiron/websites/tools/grocy.nix
@@ -0,0 +1,48 @@
1{ lib, stdenv, grocy }:
2rec {
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
8 '';
9 };
10 webRoot = grocy.webRoot;
11 apache = rec {
12 user = "wwwrun";
13 group = "wwwrun";
14 modules = [ "proxy_fcgi" ];
15 root = webRoot;
16 vhostConf = socket: ''
17 Alias /grocy "${root}"
18 <Directory "${root}">
19 DirectoryIndex index.php
20 <FilesMatch "\.php$">
21 SetHandler "proxy:unix:${socket}|fcgi://localhost"
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 ]);
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";
39
40 # Needed to avoid clashes in browser cookies (same domain)
41 "php_value[session.name]" = "grocyPHPSESSID";
42 "php_admin_value[open_basedir]" = "${basedir}:/tmp";
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:'";
45 };
46 };
47}
48