diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2020-03-29 23:51:14 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2020-03-29 23:52:02 +0200 |
commit | c7627e14666fe7dedb91ecc9f3fbd8949182f6e4 (patch) | |
tree | 3ac85be6e36005b84a09cff860197537b960de86 /modules/private/websites/tools/tools/grocy.nix | |
parent | 75d88edab0aecd0033b5d5b6257af46718e87bf4 (diff) | |
download | Nix-c7627e14666fe7dedb91ecc9f3fbd8949182f6e4.tar.gz Nix-c7627e14666fe7dedb91ecc9f3fbd8949182f6e4.tar.zst Nix-c7627e14666fe7dedb91ecc9f3fbd8949182f6e4.zip |
Add grocy
Diffstat (limited to 'modules/private/websites/tools/tools/grocy.nix')
-rw-r--r-- | modules/private/websites/tools/tools/grocy.nix | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/modules/private/websites/tools/tools/grocy.nix b/modules/private/websites/tools/tools/grocy.nix new file mode 100644 index 0000000..c165030 --- /dev/null +++ b/modules/private/websites/tools/tools/grocy.nix | |||
@@ -0,0 +1,56 @@ | |||
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 = '' | ||
22 | Alias /grocy "${root}" | ||
23 | <Directory "${root}"> | ||
24 | DirectoryIndex index.php | ||
25 | <FilesMatch "\.php$"> | ||
26 | SetHandler "proxy:unix:${phpFpm.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 | socket = "/var/run/phpfpm/grocy.sock"; | ||
39 | pool = '' | ||
40 | listen = ${socket} | ||
41 | user = ${apache.user} | ||
42 | group = ${apache.group} | ||
43 | listen.owner = ${apache.user} | ||
44 | listen.group = ${apache.group} | ||
45 | pm = ondemand | ||
46 | pm.max_children = 60 | ||
47 | pm.process_idle_timeout = 60 | ||
48 | |||
49 | ; Needed to avoid clashes in browser cookies (same domain) | ||
50 | php_value[session.name] = grocyPHPSESSID | ||
51 | php_admin_value[open_basedir] = "${basedir}:/tmp" | ||
52 | php_admin_value[session.save_path] = "${varDir}/phpSessions" | ||
53 | ''; | ||
54 | }; | ||
55 | } | ||
56 | |||