]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - modules/private/websites/tools/tools/grocy.nix
Remove duply-backup
[perso/Immae/Config/Nix.git] / modules / private / websites / tools / 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
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" ];
750fe5a4 16 root = webRoot;
5400b9b6 17 vhostConf = socket: ''
c7627e14
IB
18 Alias /grocy "${root}"
19 <Directory "${root}">
20 DirectoryIndex index.php
21 <FilesMatch "\.php$">
5400b9b6 22 SetHandler "proxy:unix:${socket}|fcgi://localhost"
c7627e14
IB
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 ]);
5400b9b6
IB
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";
c7627e14 40
5400b9b6
IB
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 };
c7627e14
IB
46 };
47}
48