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 | |
parent | 75d88edab0aecd0033b5d5b6257af46718e87bf4 (diff) | |
download | Nix-c7627e14666fe7dedb91ecc9f3fbd8949182f6e4.tar.gz Nix-c7627e14666fe7dedb91ecc9f3fbd8949182f6e4.tar.zst Nix-c7627e14666fe7dedb91ecc9f3fbd8949182f6e4.zip |
Add grocy
Diffstat (limited to 'modules/private/websites/tools')
-rw-r--r-- | modules/private/websites/tools/tools/default.nix | 8 | ||||
-rw-r--r-- | modules/private/websites/tools/tools/grocy.nix | 56 |
2 files changed, 64 insertions, 0 deletions
diff --git a/modules/private/websites/tools/tools/default.nix b/modules/private/websites/tools/tools/default.nix index 9fb2d03..e2a3913 100644 --- a/modules/private/websites/tools/tools/default.nix +++ b/modules/private/websites/tools/tools/default.nix | |||
@@ -35,6 +35,9 @@ let | |||
35 | inherit (pkgs.webapps) phpldapadmin; | 35 | inherit (pkgs.webapps) phpldapadmin; |
36 | env = config.myEnv.tools.phpldapadmin; | 36 | env = config.myEnv.tools.phpldapadmin; |
37 | }; | 37 | }; |
38 | grocy = pkgs.callPackage ./grocy.nix { | ||
39 | inherit (pkgs.webapps) grocy; | ||
40 | }; | ||
38 | 41 | ||
39 | cfg = config.myServices.websites.tools.tools; | 42 | cfg = config.myServices.websites.tools.tools; |
40 | in { | 43 | in { |
@@ -53,6 +56,7 @@ in { | |||
53 | 56 | ||
54 | services.duplyBackup.profiles = { | 57 | services.duplyBackup.profiles = { |
55 | dokuwiki = dokuwiki.backups; | 58 | dokuwiki = dokuwiki.backups; |
59 | grocy = grocy.backups; | ||
56 | kanboard = kanboard.backups; | 60 | kanboard = kanboard.backups; |
57 | rompr = rompr.backups; | 61 | rompr = rompr.backups; |
58 | shaarli = shaarli.backups; | 62 | shaarli = shaarli.backups; |
@@ -125,6 +129,7 @@ in { | |||
125 | dokuwiki.apache.vhostConf | 129 | dokuwiki.apache.vhostConf |
126 | ldap.apache.vhostConf | 130 | ldap.apache.vhostConf |
127 | kanboard.apache.vhostConf | 131 | kanboard.apache.vhostConf |
132 | grocy.apache.vhostConf | ||
128 | ]; | 133 | ]; |
129 | }; | 134 | }; |
130 | 135 | ||
@@ -252,6 +257,7 @@ in { | |||
252 | dokuwiki = dokuwiki.phpFpm.pool; | 257 | dokuwiki = dokuwiki.phpFpm.pool; |
253 | ldap = ldap.phpFpm.pool; | 258 | ldap = ldap.phpFpm.pool; |
254 | kanboard = kanboard.phpFpm.pool; | 259 | kanboard = kanboard.phpFpm.pool; |
260 | grocy = grocy.phpFpm.pool; | ||
255 | tools = '' | 261 | tools = '' |
256 | listen = /var/run/phpfpm/tools.sock | 262 | listen = /var/run/phpfpm/tools.sock |
257 | user = wwwrun | 263 | user = wwwrun |
@@ -272,6 +278,7 @@ in { | |||
272 | 278 | ||
273 | system.activationScripts = { | 279 | system.activationScripts = { |
274 | adminer = adminer.activationScript; | 280 | adminer = adminer.activationScript; |
281 | grocy = grocy.activationScript; | ||
275 | ttrss = ttrss.activationScript; | 282 | ttrss = ttrss.activationScript; |
276 | wallabag = wallabag.activationScript; | 283 | wallabag = wallabag.activationScript; |
277 | yourls = yourls.activationScript; | 284 | yourls = yourls.activationScript; |
@@ -292,6 +299,7 @@ in { | |||
292 | "${wallabag.apache.webappName}" = wallabag.webRoot; | 299 | "${wallabag.apache.webappName}" = wallabag.webRoot; |
293 | "${yourls.apache.webappName}" = yourls.webRoot; | 300 | "${yourls.apache.webappName}" = yourls.webRoot; |
294 | "${kanboard.apache.webappName}" = kanboard.webRoot; | 301 | "${kanboard.apache.webappName}" = kanboard.webRoot; |
302 | "${grocy.apache.webappName}" = grocy.webRoot; | ||
295 | }; | 303 | }; |
296 | 304 | ||
297 | services.websites.env.tools.watchPaths = [ | 305 | services.websites.env.tools.watchPaths = [ |
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 | |||