]> git.immae.eu Git - perso/Immae/Config/Nix.git/blob - modules/private/websites/tools/tools/grocy.nix
Upgrade nixos
[perso/Immae/Config/Nix.git] / modules / private / websites / tools / tools / grocy.nix
1 { lib, stdenv, grocy }:
2 rec {
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" ];
19 webappName = "tools_grocy";
20 root = "/run/current-system/webapps/${webappName}";
21 vhostConf = socket: ''
22 Alias /grocy "${root}"
23 <Directory "${root}">
24 DirectoryIndex index.php
25 <FilesMatch "\.php$">
26 SetHandler "proxy:unix:${socket}|fcgi://localhost"
27 </FilesMatch>
28
29 AllowOverride All
30 Options +FollowSymlinks
31 Require all granted
32 </Directory>
33 '';
34 };
35 phpFpm = rec {
36 basedir = builtins.concatStringsSep ":" (
37 [ grocy grocy.yarnModules varDir ]);
38 pool = {
39 "listen.owner" = apache.user;
40 "listen.group" = apache.group;
41 "pm" = "ondemand";
42 "pm.max_children" = "60";
43 "pm.process_idle_timeout" = "60";
44
45 # Needed to avoid clashes in browser cookies (same domain)
46 "php_value[session.name]" = "grocyPHPSESSID";
47 "php_admin_value[open_basedir]" = "${basedir}:/tmp";
48 "php_admin_value[session.save_path]" = "${varDir}/phpSessions";
49 };
50 };
51 }
52