]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - modules/private/websites/tools/tools/dokuwiki.nix
Compress sql dumps
[perso/Immae/Config/Nix.git] / modules / private / websites / tools / tools / dokuwiki.nix
CommitLineData
c9d13ae3
IB
1{ lib, stdenv, dokuwiki, dokuwiki-plugins }:
2rec {
6a8252b1
IB
3 backups = {
4 rootDir = varDir;
5 };
c9d13ae3
IB
6 varDir = "/var/lib/dokuwiki";
7 activationScript = {
8 deps = [ "wrappers" ];
9 text = ''
10 if [ ! -d ${varDir} ]; then
11 install -m 0755 -o ${apache.user} -g ${apache.group} -d ${varDir} \
12 ${varDir}/animals
13 cp -a ${webRoot}/conf.dist ${varDir}/conf
14 cp -a ${webRoot}/data.dist ${varDir}/data
15 cp -a ${webRoot}/
16 chown -R ${apache.user}:${apache.user} ${varDir}/config ${varDir}/data
17 chmod -R 755 ${varDir}/config ${varDir}/data
18 fi
19 install -m 0750 -o ${apache.user} -g ${apache.group} -d ${varDir}/phpSessions
20 '';
21 };
34c7b88e 22 webRoot = dokuwiki.withPlugins (p: [ p.farmer p.todo ]);
c9d13ae3
IB
23 apache = rec {
24 user = "wwwrun";
25 group = "wwwrun";
26 modules = [ "proxy_fcgi" ];
27 webappName = "tools_dokuwiki";
28 root = "/run/current-system/webapps/${webappName}";
5400b9b6 29 vhostConf = socket: ''
c9d13ae3
IB
30 Alias /dokuwiki "${root}"
31 <Directory "${root}">
32 DirectoryIndex index.php
33 <FilesMatch "\.php$">
5400b9b6 34 SetHandler "proxy:unix:${socket}|fcgi://localhost"
c9d13ae3 35 </FilesMatch>
b892dcbe 36
c9d13ae3
IB
37 AllowOverride All
38 Options +FollowSymlinks
39 Require all granted
40 </Directory>
41 '';
42 };
43 phpFpm = rec {
44 serviceDeps = [ "openldap.service" ];
45 basedir = builtins.concatStringsSep ":" (
46 [ webRoot varDir ] ++ webRoot.plugins);
5400b9b6
IB
47 pool = {
48 "listen.owner" = apache.user;
49 "listen.group" = apache.group;
50 "pm" = "ondemand";
51 "pm.max_children" = "60";
52 "pm.process_idle_timeout" = "60";
b892dcbe 53
5400b9b6
IB
54 # Needed to avoid clashes in browser cookies (same domain)
55 "php_value[session.name]" = "DokuwikiPHPSESSID";
56 "php_admin_value[open_basedir]" = "${basedir}:/tmp";
57 "php_admin_value[session.save_path]" = "${varDir}/phpSessions";
58 };
b892dcbe 59 };
c9d13ae3 60}