diff options
Diffstat (limited to 'nixops/modules/websites')
5 files changed, 152 insertions, 1 deletions
diff --git a/nixops/modules/websites/tools/tools/default.nix b/nixops/modules/websites/tools/tools/default.nix index 41f47a3..0b50a7c 100644 --- a/nixops/modules/websites/tools/tools/default.nix +++ b/nixops/modules/websites/tools/tools/default.nix | |||
@@ -21,6 +21,9 @@ let | |||
21 | shaarli = pkgs.callPackage ./shaarli.nix { | 21 | shaarli = pkgs.callPackage ./shaarli.nix { |
22 | env = myconfig.env.tools.shaarli; | 22 | env = myconfig.env.tools.shaarli; |
23 | }; | 23 | }; |
24 | dokuwiki = pkgs.callPackage ./dokuwiki.nix { | ||
25 | inherit (mylibs) fetchedGithub; | ||
26 | }; | ||
24 | 27 | ||
25 | cfg = config.services.myWebsites.tools.tools; | 28 | cfg = config.services.myWebsites.tools.tools; |
26 | in { | 29 | in { |
@@ -39,7 +42,8 @@ in { | |||
39 | ++ wallabag.apache.modules | 42 | ++ wallabag.apache.modules |
40 | ++ yourls.apache.modules | 43 | ++ yourls.apache.modules |
41 | ++ rompr.apache.modules | 44 | ++ rompr.apache.modules |
42 | ++ shaarli.apache.modules; | 45 | ++ shaarli.apache.modules |
46 | ++ dokuwiki.apache.modules; | ||
43 | 47 | ||
44 | services.ympd = ympd.config // { enable = true; }; | 48 | services.ympd = ympd.config // { enable = true; }; |
45 | 49 | ||
@@ -56,6 +60,7 @@ in { | |||
56 | yourls.apache.vhostConf | 60 | yourls.apache.vhostConf |
57 | rompr.apache.vhostConf | 61 | rompr.apache.vhostConf |
58 | shaarli.apache.vhostConf | 62 | shaarli.apache.vhostConf |
63 | dokuwiki.apache.vhostConf | ||
59 | ]; | 64 | ]; |
60 | }; | 65 | }; |
61 | 66 | ||
@@ -67,6 +72,7 @@ in { | |||
67 | yourls = yourls.phpFpm.pool; | 72 | yourls = yourls.phpFpm.pool; |
68 | rompr = rompr.phpFpm.pool; | 73 | rompr = rompr.phpFpm.pool; |
69 | shaarli = shaarli.phpFpm.pool; | 74 | shaarli = shaarli.phpFpm.pool; |
75 | dokuwiki = dokuwiki.phpFpm.pool; | ||
70 | }; | 76 | }; |
71 | 77 | ||
72 | system.activationScripts = { | 78 | system.activationScripts = { |
@@ -76,6 +82,7 @@ in { | |||
76 | yourls = yourls.activationScript; | 82 | yourls = yourls.activationScript; |
77 | rompr = rompr.activationScript; | 83 | rompr = rompr.activationScript; |
78 | shaarli = shaarli.activationScript; | 84 | shaarli = shaarli.activationScript; |
85 | dokuwiki = dokuwiki.activationScript; | ||
79 | }; | 86 | }; |
80 | 87 | ||
81 | systemd.services.tt-rss = { | 88 | systemd.services.tt-rss = { |
diff --git a/nixops/modules/websites/tools/tools/dokuwiki-plugin-farmer.json b/nixops/modules/websites/tools/tools/dokuwiki-plugin-farmer.json new file mode 100644 index 0000000..4022eb4 --- /dev/null +++ b/nixops/modules/websites/tools/tools/dokuwiki-plugin-farmer.json | |||
@@ -0,0 +1,15 @@ | |||
1 | { | ||
2 | "tag": "72b8577-master", | ||
3 | "meta": { | ||
4 | "name": "dokuwiki-plugin-farmer", | ||
5 | "url": "https://github.com/cosmocode/dokuwiki-plugin-farmer", | ||
6 | "branch": "master" | ||
7 | }, | ||
8 | "github": { | ||
9 | "owner": "cosmocode", | ||
10 | "repo": "dokuwiki-plugin-farmer", | ||
11 | "rev": "72b857734fd164bf79cc6e17abe56491d55c1072", | ||
12 | "sha256": "1c9vc1z7yvzjz4p054kshb9yd00a4bb52s43k9zav0lvwvjij9l0", | ||
13 | "fetchSubmodules": true | ||
14 | } | ||
15 | } | ||
diff --git a/nixops/modules/websites/tools/tools/dokuwiki-plugin-todo.json b/nixops/modules/websites/tools/tools/dokuwiki-plugin-todo.json new file mode 100644 index 0000000..9576826 --- /dev/null +++ b/nixops/modules/websites/tools/tools/dokuwiki-plugin-todo.json | |||
@@ -0,0 +1,15 @@ | |||
1 | { | ||
2 | "tag": "49068ec-master", | ||
3 | "meta": { | ||
4 | "name": "dokuwiki-plugin-todo", | ||
5 | "url": "https://github.com/leibler/dokuwiki-plugin-todo", | ||
6 | "branch": "master" | ||
7 | }, | ||
8 | "github": { | ||
9 | "owner": "leibler", | ||
10 | "repo": "dokuwiki-plugin-todo", | ||
11 | "rev": "49068ecea455ea997d1e4a7adab171ccaf8228e8", | ||
12 | "sha256": "1jaq623kp14fyhamsas5mk9ryqlk4q6x6znijrb5xhcdg3r83gmq", | ||
13 | "fetchSubmodules": true | ||
14 | } | ||
15 | } | ||
diff --git a/nixops/modules/websites/tools/tools/dokuwiki.json b/nixops/modules/websites/tools/tools/dokuwiki.json new file mode 100644 index 0000000..fc03252 --- /dev/null +++ b/nixops/modules/websites/tools/tools/dokuwiki.json | |||
@@ -0,0 +1,15 @@ | |||
1 | { | ||
2 | "tag": "release_stable_2018-04-22b", | ||
3 | "meta": { | ||
4 | "name": "dokuwiki", | ||
5 | "url": "https://github.com/splitbrain/dokuwiki", | ||
6 | "branch": "refs/tags/release_stable_2018-04-22b" | ||
7 | }, | ||
8 | "github": { | ||
9 | "owner": "splitbrain", | ||
10 | "repo": "dokuwiki", | ||
11 | "rev": "871dae1320b40211626c7ec665f5e6d5290aca95", | ||
12 | "sha256": "1syvd5dvv3v75swf8ig7dxqs0g5xikb0f6vlcy7g4c4ghldkw7nz", | ||
13 | "fetchSubmodules": true | ||
14 | } | ||
15 | } | ||
diff --git a/nixops/modules/websites/tools/tools/dokuwiki.nix b/nixops/modules/websites/tools/tools/dokuwiki.nix new file mode 100644 index 0000000..5affddb --- /dev/null +++ b/nixops/modules/websites/tools/tools/dokuwiki.nix | |||
@@ -0,0 +1,99 @@ | |||
1 | { lib, php, stdenv, writeText, fetchedGithub }: | ||
2 | let | ||
3 | dokuwiki = let | ||
4 | plugins = { | ||
5 | farmer = stdenv.mkDerivation (fetchedGithub ./dokuwiki-plugin-farmer.json // rec { | ||
6 | installPhase = '' | ||
7 | mkdir $out | ||
8 | cp -a * $out/ | ||
9 | ''; | ||
10 | }); | ||
11 | todo = stdenv.mkDerivation (fetchedGithub ./dokuwiki-plugin-todo.json // rec { | ||
12 | installPhase = '' | ||
13 | mkdir $out | ||
14 | cp -a * $out/ | ||
15 | ''; | ||
16 | }); | ||
17 | }; | ||
18 | preload = writeText "preload.php" '' | ||
19 | <?php | ||
20 | # farm setup by farmer plugin | ||
21 | if(file_exists('${plugins.farmer}/DokuWikiFarmCore.php')) | ||
22 | { | ||
23 | include('${plugins.farmer}/DokuWikiFarmCore.php'); | ||
24 | } | ||
25 | ''; | ||
26 | in rec { | ||
27 | varDir = "/var/lib/dokuwiki"; | ||
28 | activationScript = { | ||
29 | deps = [ "wrappers" ]; | ||
30 | text = '' | ||
31 | if [ ! -d ${varDir} ]; then | ||
32 | install -m 0755 -o ${apache.user} -g ${apache.group} -d ${varDir} \ | ||
33 | ${varDir}/animals | ||
34 | cp -a ${webRoot}/conf.dist ${varDir}/conf | ||
35 | cp -a ${webRoot}/data.dist ${varDir}/data | ||
36 | cp -a ${webRoot}/ | ||
37 | chown -R ${apache.user}:${apache.user} ${varDir}/config ${varDir}/data | ||
38 | chmod -R 755 ${varDir}/config ${varDir}/data | ||
39 | fi | ||
40 | install -m 0750 -o ${apache.user} -g ${apache.group} -d ${varDir}/phpSessions | ||
41 | ''; | ||
42 | }; | ||
43 | webRoot = stdenv.mkDerivation (fetchedGithub ./dokuwiki.json // rec { | ||
44 | buildPhase = '' | ||
45 | mv conf conf.dist | ||
46 | mv data data.dist | ||
47 | ''; | ||
48 | installPhase = '' | ||
49 | cp -a . $out | ||
50 | cp ${preload} $out/inc/preload.php | ||
51 | ln -sf ../../../../../${varDir}/{conf,data} $out/ | ||
52 | ln -sf ../../../../../${varDir}/conf/.htaccess $out/ | ||
53 | ${builtins.concatStringsSep "\n" ( | ||
54 | lib.attrsets.mapAttrsToList (name: value: "ln -sf ${value} $out/lib/plugins/${name}") plugins | ||
55 | )} | ||
56 | ''; | ||
57 | }); | ||
58 | apache = { | ||
59 | user = "wwwrun"; | ||
60 | group = "wwwrun"; | ||
61 | modules = [ "proxy_fcgi" ]; | ||
62 | vhostConf = '' | ||
63 | Alias /dokuwiki "${webRoot}" | ||
64 | <Directory "${webRoot}"> | ||
65 | DirectoryIndex index.php | ||
66 | <FilesMatch "\.php$"> | ||
67 | SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost" | ||
68 | </FilesMatch> | ||
69 | |||
70 | AllowOverride All | ||
71 | Options +FollowSymlinks | ||
72 | Require all granted | ||
73 | </Directory> | ||
74 | ''; | ||
75 | }; | ||
76 | phpFpm = rec { | ||
77 | basedir = builtins.concatStringsSep ":" ( | ||
78 | [ webRoot varDir ] | ||
79 | ++ lib.attrsets.mapAttrsToList (name: value: value) plugins); | ||
80 | socket = "/var/run/phpfpm/dokuwiki.sock"; | ||
81 | pool = '' | ||
82 | listen = ${socket} | ||
83 | user = ${apache.user} | ||
84 | group = ${apache.group} | ||
85 | listen.owner = ${apache.user} | ||
86 | listen.group = ${apache.group} | ||
87 | pm = ondemand | ||
88 | pm.max_children = 60 | ||
89 | pm.process_idle_timeout = 60 | ||
90 | |||
91 | ; Needed to avoid clashes in browser cookies (same domain) | ||
92 | php_value[session.name] = DokuwikiPHPSESSID | ||
93 | php_admin_value[open_basedir] = "${basedir}:/tmp" | ||
94 | php_admin_value[session.save_path] = "${varDir}/phpSessions" | ||
95 | ''; | ||
96 | }; | ||
97 | }; | ||
98 | in | ||
99 | dokuwiki | ||