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