aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/private/websites/tools/tools/default.nix41
-rw-r--r--modules/private/websites/tools/tools/phpbb.nix59
-rw-r--r--pkgs/webapps/default.nix2
-rw-r--r--pkgs/webapps/phpbb/default.nix60
-rw-r--r--pkgs/webapps/phpbb/extensions/adduser.nix22
-rw-r--r--pkgs/webapps/phpbb/extensions/autosubscribe.nix19
-rw-r--r--pkgs/webapps/phpbb/extensions/mailinglist.nix18
-rw-r--r--pkgs/webapps/phpbb/extensions/markdown.nix20
-rw-r--r--pkgs/webapps/phpbb/extensions/mchat.nix21
-rw-r--r--pkgs/webapps/phpbb/extensions/monitoranswers.nix19
-rw-r--r--pkgs/webapps/phpbb/langs/fr.nix12
11 files changed, 275 insertions, 18 deletions
diff --git a/modules/private/websites/tools/tools/default.nix b/modules/private/websites/tools/tools/default.nix
index dbd65e6..0cb7a10 100644
--- a/modules/private/websites/tools/tools/default.nix
+++ b/modules/private/websites/tools/tools/default.nix
@@ -38,6 +38,12 @@ let
38 grocy = pkgs.callPackage ./grocy.nix { 38 grocy = pkgs.callPackage ./grocy.nix {
39 inherit (pkgs.webapps) grocy; 39 inherit (pkgs.webapps) grocy;
40 }; 40 };
41 phpbb = pkgs.callPackage ./phpbb.nix {
42 phpbb = (pkgs.webapps.phpbb.withLangs (l: [ l.fr ])).withExts (e: [
43 e.alfredoramos.markdown e.davidiq.mailinglist e.dmzx.mchat
44 e.empteintesduweb.monitoranswers e.lr94.autosubscribe
45 e.phpbbmodders.adduser ]);
46 };
41 webhooks = pkgs.callPackage ./webhooks.nix { 47 webhooks = pkgs.callPackage ./webhooks.nix {
42 env = config.myEnv.tools.webhooks; 48 env = config.myEnv.tools.webhooks;
43 }; 49 };
@@ -69,6 +75,7 @@ in {
69 shaarli = shaarli.backups; 75 shaarli = shaarli.backups;
70 ttrss = ttrss.backups; 76 ttrss = ttrss.backups;
71 wallabag = wallabag.backups; 77 wallabag = wallabag.backups;
78 phpbb = phpbb.backups;
72 }; 79 };
73 80
74 services.websites.env.tools.modules = 81 services.websites.env.tools.modules =
@@ -81,6 +88,7 @@ in {
81 ++ rompr.apache.modules 88 ++ rompr.apache.modules
82 ++ shaarli.apache.modules 89 ++ shaarli.apache.modules
83 ++ dokuwiki.apache.modules 90 ++ dokuwiki.apache.modules
91 ++ phpbb.apache.modules
84 ++ ldap.apache.modules 92 ++ ldap.apache.modules
85 ++ kanboard.apache.modules; 93 ++ kanboard.apache.modules;
86 94
@@ -110,14 +118,13 @@ in {
110 certName = "eldiron"; 118 certName = "eldiron";
111 addToCerts = true; 119 addToCerts = true;
112 hosts = ["tools.immae.eu" ]; 120 hosts = ["tools.immae.eu" ];
113 root = "/var/lib/ftp/tools.immae.eu"; 121 root = landing;
114 extraConfig = [ 122 extraConfig = [
115 '' 123 ''
116 RedirectMatch 301 ^/vpn(.*)$ https://vpn.immae.eu$1 124 RedirectMatch 301 ^/vpn(.*)$ https://vpn.immae.eu$1
117 RedirectMatch 301 ^/roundcube(.*)$ https://mail.immae.eu/roundcube$1 125 RedirectMatch 301 ^/roundcube(.*)$ https://mail.immae.eu/roundcube$1
118 RedirectMatch 301 ^/jappix(.*)$ https://im.immae.fr/converse 126 RedirectMatch 301 ^/jappix(.*)$ https://im.immae.fr/converse
119 127
120 Alias /landing ${landing}
121 <Directory "${landing}"> 128 <Directory "${landing}">
122 DirectoryIndex index.html 129 DirectoryIndex index.html
123 AllowOverride None 130 AllowOverride None
@@ -127,20 +134,6 @@ in {
127 SetHandler "proxy:unix:${pcfg.tools.socket}|fcgi://localhost" 134 SetHandler "proxy:unix:${pcfg.tools.socket}|fcgi://localhost"
128 </FilesMatch> 135 </FilesMatch>
129 </Directory> 136 </Directory>
130
131 <Directory "/var/lib/ftp/tools.immae.eu">
132 DirectoryIndex index.php index.htm index.html
133 AllowOverride all
134 Require all granted
135 <FilesMatch "\.php$">
136 SetHandler "proxy:unix:${pcfg.tools.socket}|fcgi://localhost"
137 </FilesMatch>
138
139 RewriteEngine On
140 RewriteCond ${landing}%{REQUEST_URI} -f
141 RewriteRule ^(.*)$ /landing/$1 [L]
142 RewriteRule ^$ /landing/ [L]
143 </Directory>
144 '' 137 ''
145 (adminer.apache.vhostConf pcfg.adminer.socket) 138 (adminer.apache.vhostConf pcfg.adminer.socket)
146 ympd.apache.vhostConf 139 ympd.apache.vhostConf
@@ -153,6 +146,7 @@ in {
153 (ldap.apache.vhostConf pcfg.ldap.socket) 146 (ldap.apache.vhostConf pcfg.ldap.socket)
154 (kanboard.apache.vhostConf pcfg.kanboard.socket) 147 (kanboard.apache.vhostConf pcfg.kanboard.socket)
155 (grocy.apache.vhostConf pcfg.grocy.socket) 148 (grocy.apache.vhostConf pcfg.grocy.socket)
149 (phpbb.apache.vhostConf pcfg.phpbb.socket)
156 '' 150 ''
157 Alias /paste /var/lib/fiche 151 Alias /paste /var/lib/fiche
158 <Directory "/var/lib/fiche"> 152 <Directory "/var/lib/fiche">
@@ -219,6 +213,10 @@ in {
219 after = lib.mkAfter dokuwiki.phpFpm.serviceDeps; 213 after = lib.mkAfter dokuwiki.phpFpm.serviceDeps;
220 wants = dokuwiki.phpFpm.serviceDeps; 214 wants = dokuwiki.phpFpm.serviceDeps;
221 }; 215 };
216 phpfpm-phpbb = {
217 after = lib.mkAfter phpbb.phpFpm.serviceDeps;
218 wants = phpbb.phpFpm.serviceDeps;
219 };
222 phpfpm-kanboard = { 220 phpfpm-kanboard = {
223 after = lib.mkAfter kanboard.phpFpm.serviceDeps; 221 after = lib.mkAfter kanboard.phpFpm.serviceDeps;
224 wants = kanboard.phpFpm.serviceDeps; 222 wants = kanboard.phpFpm.serviceDeps;
@@ -289,8 +287,8 @@ in {
289 # Needed to avoid clashes in browser cookies (same domain) 287 # Needed to avoid clashes in browser cookies (same domain)
290 "php_value[session.name]" = "ToolsPHPSESSID"; 288 "php_value[session.name]" = "ToolsPHPSESSID";
291 "php_admin_value[open_basedir]" = builtins.concatStringsSep ":" [ 289 "php_admin_value[open_basedir]" = builtins.concatStringsSep ":" [
292 "/run/wrappers/bin/sendmail" "/var/lib/ftp/tools.immae.eu" 290 "/run/wrappers/bin/sendmail" landing "/tmp"
293 landing "/tmp" "${config.secrets.location}/webapps/webhooks" 291 "${config.secrets.location}/webapps/webhooks"
294 ]; 292 ];
295 }; 293 };
296 phpEnv = { 294 phpEnv = {
@@ -349,6 +347,11 @@ in {
349 group = "wwwrun"; 347 group = "wwwrun";
350 settings = dokuwiki.phpFpm.pool; 348 settings = dokuwiki.phpFpm.pool;
351 }; 349 };
350 phpbb = {
351 user = "wwwrun";
352 group = "wwwrun";
353 settings = phpbb.phpFpm.pool;
354 };
352 ldap = { 355 ldap = {
353 user = "wwwrun"; 356 user = "wwwrun";
354 group = "wwwrun"; 357 group = "wwwrun";
@@ -376,6 +379,7 @@ in {
376 rompr = rompr.activationScript; 379 rompr = rompr.activationScript;
377 shaarli = shaarli.activationScript; 380 shaarli = shaarli.activationScript;
378 dokuwiki = dokuwiki.activationScript; 381 dokuwiki = dokuwiki.activationScript;
382 phpbb = phpbb.activationScript;
379 kanboard = kanboard.activationScript; 383 kanboard = kanboard.activationScript;
380 ldap = ldap.activationScript; 384 ldap = ldap.activationScript;
381 }; 385 };
@@ -383,6 +387,7 @@ in {
383 services.websites.webappDirs = { 387 services.websites.webappDirs = {
384 _adminer = adminer.webRoot; 388 _adminer = adminer.webRoot;
385 "${dokuwiki.apache.webappName}" = dokuwiki.webRoot; 389 "${dokuwiki.apache.webappName}" = dokuwiki.webRoot;
390 "${phpbb.apache.webappName}" = phpbb.webRoot;
386 "${ldap.apache.webappName}" = "${ldap.webRoot}/htdocs"; 391 "${ldap.apache.webappName}" = "${ldap.webRoot}/htdocs";
387 "${rompr.apache.webappName}" = rompr.webRoot; 392 "${rompr.apache.webappName}" = rompr.webRoot;
388 "${shaarli.apache.webappName}" = shaarli.webRoot; 393 "${shaarli.apache.webappName}" = shaarli.webRoot;
diff --git a/modules/private/websites/tools/tools/phpbb.nix b/modules/private/websites/tools/tools/phpbb.nix
new file mode 100644
index 0000000..fa26069
--- /dev/null
+++ b/modules/private/websites/tools/tools/phpbb.nix
@@ -0,0 +1,59 @@
1{ lib, phpbb, gnused }:
2rec {
3 backups = {
4 rootDir = varDir;
5 };
6 varDir = "/var/lib/phpbb";
7 activationScript = {
8 deps = [ "wrappers" ];
9 text = ''
10 if [ ! -d ${varDir} ]; then
11 install -m 0755 -o ${apache.user} -g ${apache.user} -d ${varDir}
12 cp -a ${phpbb}/vars/* ${varDir}
13 chown -R ${apache.user}:${apache.user} ${varDir}
14 fi
15 install -m 0750 -o ${apache.user} -g ${apache.group} -d ${varDir}/phpSessions
16 '';
17 };
18 webRoot = phpbb;
19 apache = rec {
20 user = "wwwrun";
21 group = "wwwrun";
22 modules = [ "proxy_fcgi" ];
23 webappName = "tools_phpbb";
24 root = "/run/current-system/webapps/${webappName}";
25 vhostConf = socket: ''
26 Alias /forum "${root}"
27 <Directory "${root}">
28 DirectoryIndex index.php
29 <FilesMatch "\.php$">
30 SetHandler "proxy:unix:${socket}|fcgi://localhost"
31 </FilesMatch>
32
33 AllowOverride All
34 Options FollowSymlinks
35 Require all granted
36 </Directory>
37 # add instal to the list after install
38 <LocationMatch "^/(cache|files|install|store)>
39 Require all denied
40 </LocationMatch>
41 '';
42 };
43 phpFpm = rec {
44 serviceDeps = [ "postgresql.service" ];
45 basedir = builtins.concatStringsSep ":" [ "/run/wrappers/bin/sendmail" phpbb varDir ];
46 pool = {
47 "listen.owner" = apache.user;
48 "listen.group" = apache.group;
49 "pm" = "ondemand";
50 "pm.max_children" = "60";
51 "pm.process_idle_timeout" = "60";
52
53 # Needed to avoid clashes in browser cookies (same domain)
54 "php_value[session.name]" = "PhpBBPHPSESSID";
55 "php_admin_value[open_basedir]" = "${basedir}:/tmp";
56 "php_admin_value[session.save_path]" = "${varDir}/phpSessions";
57 };
58 };
59}
diff --git a/pkgs/webapps/default.nix b/pkgs/webapps/default.nix
index 8cc252d..3117f7e 100644
--- a/pkgs/webapps/default.nix
+++ b/pkgs/webapps/default.nix
@@ -69,6 +69,8 @@ rec {
69 (name: callPackage (./nextcloud/apps + "/${name}.nix") { buildApp = nextcloud.buildApp; }); 69 (name: callPackage (./nextcloud/apps + "/${name}.nix") { buildApp = nextcloud.buildApp; });
70 70
71 peertube = callPackage ./peertube { inherit mylibs; }; 71 peertube = callPackage ./peertube { inherit mylibs; };
72 phpbb = callPackage ./phpbb {};
73
72 phpldapadmin = callPackage ./phpldapadmin {}; 74 phpldapadmin = callPackage ./phpldapadmin {};
73 rompr = callPackage ./rompr { inherit mylibs; }; 75 rompr = callPackage ./rompr { inherit mylibs; };
74 76
diff --git a/pkgs/webapps/phpbb/default.nix b/pkgs/webapps/phpbb/default.nix
new file mode 100644
index 0000000..d7d008e
--- /dev/null
+++ b/pkgs/webapps/phpbb/default.nix
@@ -0,0 +1,60 @@
1{ stdenv, fetchurl, callPackage
2, varDir ? "/var/lib/phpbb"
3}:
4let
5 allExts = {
6 alfredoramos.markdown = callPackage ./extensions/markdown.nix {};
7 davidiq.mailinglist = callPackage ./extensions/mailinglist.nix {};
8 dmzx.mchat = callPackage ./extensions/mchat.nix {};
9 empteintesduweb.monitoranswers = callPackage ./extensions/monitoranswers.nix {};
10 lr94.autosubscribe = callPackage ./extensions/autosubscribe.nix {};
11 phpbbmodders.adduser = callPackage ./extensions/adduser.nix {};
12 };
13 allLangs = {
14 fr = callPackage ./langs/fr.nix {};
15 };
16 toPassthru = pkg: {
17 withLangs = withLangs pkg;
18 withExts = withExts pkg;
19 };
20 withExts = pkg: toExts:
21 let
22 exts = toExts allExts;
23 toInstallExt = ext: "cp -r ${ext}/* $out/ext/";
24 newPhpBB = pkg.overrideAttrs(old: {
25 installPhase = old.installPhase + "\n" + builtins.concatStringsSep "\n" (map toInstallExt exts);
26 passthru = toPassthru newPhpBB;
27 });
28 in newPhpBB;
29 withLangs = pkg: toLangs:
30 let
31 langs = toLangs allLangs;
32 toInstallLang = lang: "cp -r ${lang}/*/ $out";
33 newPhpBB = pkg.overrideAttrs(old: {
34 installPhase = old.installPhase + "\n" + builtins.concatStringsSep "\n" (map toInstallLang langs);
35 passthru = toPassthru newPhpBB;
36 });
37 in newPhpBB;
38 phpBB = stdenv.mkDerivation rec {
39 pname = "phpBB";
40 version = "3.3.0";
41
42 src = fetchurl {
43 url = "https://download.phpbb.com/pub/release/3.3/${version}/${pname}-${version}.tar.bz2";
44 sha256 = "a6234ac9dcf9086c025ece29a0a235f997a92bb9a994eff0ddcf8917e841262f";
45 };
46
47 phases = [ "unpackPhase" "installPhase" ];
48
49 installPhase = ''
50 cp -a . $out
51 mkdir -p $out/vars
52 mv $out/{cache,files,store,config.php} $out/vars
53 ln -s ${varDir}/{cache,files,store,config.php} $out/
54 echo -e "core:\n allow_install_dir: true" >> $out/config/production/config.yml
55 '';
56
57 passthru = toPassthru phpBB;
58 };
59in
60 phpBB
diff --git a/pkgs/webapps/phpbb/extensions/adduser.nix b/pkgs/webapps/phpbb/extensions/adduser.nix
new file mode 100644
index 0000000..f9073e6
--- /dev/null
+++ b/pkgs/webapps/phpbb/extensions/adduser.nix
@@ -0,0 +1,22 @@
1{ stdenv, fetchurl, unzip }:
2stdenv.mkDerivation rec {
3 pname = "phpBB-extension-adduser";
4 version = "1.0.4";
5 src = fetchurl {
6 # https://www.phpbb.com/customise/db/extension/acp_add_user_2
7 url = "https://www.phpbb.com/customise/db/download/141601";
8 sha256 = "13m4anib74cinnv1ap3b1ncb8cxm3mzhhmlqhbrr9mlrqmwf4zg2";
9 };
10
11 buildInputs = [ unzip ];
12 phases = [ "unpackPhase" "installPhase" ];
13 unpackPhase = ''
14 mkdir src
15 cd src
16 unzip $src
17 '';
18 installPhase = ''
19 cp -a . $out
20 cp -a $out/phpbbmodders/adduser/language/en $out/phpbbmodders/adduser/language/fr
21 '';
22}
diff --git a/pkgs/webapps/phpbb/extensions/autosubscribe.nix b/pkgs/webapps/phpbb/extensions/autosubscribe.nix
new file mode 100644
index 0000000..78e23fc
--- /dev/null
+++ b/pkgs/webapps/phpbb/extensions/autosubscribe.nix
@@ -0,0 +1,19 @@
1{ stdenv, fetchurl, unzip }:
2stdenv.mkDerivation rec {
3 pname = "phpBB-extension-autosubscribe";
4 version = "1.1.0";
5 src = fetchurl {
6 # https://www.phpbb.com/customise/db/extension/autosubscribe
7 url = "https://www.phpbb.com/customise/db/download/146556";
8 sha256 = "0dsay463g4impw86w1nv307nslc195fkgkqmihfn5kc0hya0giv0";
9 };
10
11 buildInputs = [ unzip ];
12 phases = [ "unpackPhase" "installPhase" ];
13 unpackPhase = ''
14 mkdir src
15 cd src
16 unzip $src
17 '';
18 installPhase = "cp -a . $out";
19}
diff --git a/pkgs/webapps/phpbb/extensions/mailinglist.nix b/pkgs/webapps/phpbb/extensions/mailinglist.nix
new file mode 100644
index 0000000..d432aaf
--- /dev/null
+++ b/pkgs/webapps/phpbb/extensions/mailinglist.nix
@@ -0,0 +1,18 @@
1{ stdenv, fetchurl, unzip }:
2stdenv.mkDerivation rec {
3 pname = "phpBB-extension-MailingList";
4 version = "2.0.0";
5 src = fetchurl {
6 url = "https://github.com/DavidIQ/MailingList/archive/${version}.tar.gz";
7 sha256 = "1ddg8bci85jwmvyakcwdn4yzqwz1rgy7ljf4nmfk9p2kvx2nhj62";
8 };
9
10 phases = [ "unpackPhase" "installPhase" ];
11 installPhase = ''
12 mkdir -p $out/davidiq/mailinglist
13 cp -a . $out/davidiq/mailinglist
14 # delete last two lines which contain EMAIL_SIG
15 sed -i -n -e :a -e '1,2!{P;N;D;};N;ba' $out/davidiq/mailinglist/language/en/email/*
16 '';
17}
18
diff --git a/pkgs/webapps/phpbb/extensions/markdown.nix b/pkgs/webapps/phpbb/extensions/markdown.nix
new file mode 100644
index 0000000..3bd73c7
--- /dev/null
+++ b/pkgs/webapps/phpbb/extensions/markdown.nix
@@ -0,0 +1,20 @@
1{ stdenv, fetchurl, unzip }:
2stdenv.mkDerivation rec {
3 pname = "phpBB-extension-markdown";
4 version = "1.2.0";
5 src = fetchurl {
6 # https://www.phpbb.com/customise/db/extension/markdown
7 name = "alfredoramos_markdown_${version}.zip";
8 url = "https://www.phpbb.com/customise/db/download/173626";
9 sha256 = "0bmgi8qr6azaaz8xnz8dkyf147dyawqvqr93r01qbm9s8bfkpzqx";
10 };
11
12 buildInputs = [ unzip ];
13 phases = [ "unpackPhase" "installPhase" ];
14 unpackPhase = ''
15 mkdir src
16 cd src
17 unzip $src
18 '';
19 installPhase = "cp -a . $out";
20}
diff --git a/pkgs/webapps/phpbb/extensions/mchat.nix b/pkgs/webapps/phpbb/extensions/mchat.nix
new file mode 100644
index 0000000..93ea861
--- /dev/null
+++ b/pkgs/webapps/phpbb/extensions/mchat.nix
@@ -0,0 +1,21 @@
1{ stdenv, fetchurl, unzip }:
2stdenv.mkDerivation rec {
3 pname = "phpBB-extension-mchat";
4 version = "2.1.3";
5 src = fetchurl {
6 # https://www.phpbb.com/customise/db/extension/mchat_extension
7 name = "dmzx_mchat_${version}.zip";
8 url = "https://www.phpbb.com/customise/db/download/168331";
9 sha256 = "0mcka02wamn899vg64m1c5d5k6f4qml18cshhzfvccrdc7a0m5p1";
10 };
11
12 buildInputs = [ unzip ];
13 phases = [ "unpackPhase" "installPhase" ];
14 unpackPhase = ''
15 mkdir src
16 cd src
17 unzip $src
18 '';
19 installPhase = "cp -a . $out";
20}
21
diff --git a/pkgs/webapps/phpbb/extensions/monitoranswers.nix b/pkgs/webapps/phpbb/extensions/monitoranswers.nix
new file mode 100644
index 0000000..52c852e
--- /dev/null
+++ b/pkgs/webapps/phpbb/extensions/monitoranswers.nix
@@ -0,0 +1,19 @@
1{ stdenv, fetchurl, unzip }:
2stdenv.mkDerivation rec {
3 pname = "phpBB-extension-monitoranswers";
4 version = "1.0.0";
5 src = fetchurl {
6 # http://forums.phpbb-fr.com/extensions-developpement-en-cours/sujet208410.html
7 url = "https://www.empreintesduweb.com/dl/extension_empreintesduweb_monitoranswers_v100.zip";
8 sha256 = "0g5khzz7brkra9rnnjh8vsv11h8vf36pcw53b4wrkcjb66bfm20s";
9 };
10
11 buildInputs = [ unzip ];
12 phases = [ "unpackPhase" "installPhase" ];
13 unpackPhase = ''
14 mkdir src
15 cd src
16 unzip $src
17 '';
18 installPhase = "cp -a . $out";
19}
diff --git a/pkgs/webapps/phpbb/langs/fr.nix b/pkgs/webapps/phpbb/langs/fr.nix
new file mode 100644
index 0000000..12f2df0
--- /dev/null
+++ b/pkgs/webapps/phpbb/langs/fr.nix
@@ -0,0 +1,12 @@
1{ stdenv, fetchurl }:
2stdenv.mkDerivation rec {
3 pname = "phpBB-language-fr";
4 version = "v4.0.0";
5 src = fetchurl {
6 url = "https://github.com/milescellar/phpbb-language-fr/archive/${version}.tar.gz";
7 sha256 = "0pkw55pb8ka4ayn1861hwvjwzs8vkq04yaxrs7zm9c8lh2g7y8z0";
8 };
9
10 phases = [ "unpackPhase" "installPhase" ];
11 installPhase = "cp -a . $out";
12}