aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nixops/modules/websites/tools/git/default.nix5
-rw-r--r--nixops/modules/websites/tools/git/gitweb.nix (renamed from nixops/modules/websites/tools/git/gitweb/gitweb.nix)0
-rw-r--r--nixops/modules/websites/tools/git/mantisbt.nix90
-rw-r--r--nixops/modules/websites/tools/git/mantisbt/mantisbt-plugin-slack.json15
-rw-r--r--nixops/modules/websites/tools/git/mantisbt/mantisbt-plugin-source-integration.json15
-rw-r--r--nixops/modules/websites/tools/git/mantisbt/mantisbt.nix128
-rw-r--r--pkgs/webapps/default.nix8
-rw-r--r--pkgs/webapps/mantisbt_2/bug_report.php.diff (renamed from nixops/modules/websites/tools/git/mantisbt/patches/bug_report.php.diff)16
-rw-r--r--pkgs/webapps/mantisbt_2/bug_report_page.php.diff (renamed from nixops/modules/websites/tools/git/mantisbt/patches/bug_report_page.php.diff)0
-rw-r--r--pkgs/webapps/mantisbt_2/bugnote_add.php.diff (renamed from nixops/modules/websites/tools/git/mantisbt/patches/bugnote_add.php.diff)0
-rw-r--r--pkgs/webapps/mantisbt_2/bugnote_add_inc.php.diff (renamed from nixops/modules/websites/tools/git/mantisbt/patches/bugnote_add_inc.php.diff)0
-rw-r--r--pkgs/webapps/mantisbt_2/default.nix39
-rw-r--r--pkgs/webapps/mantisbt_2/plugins/slack/default.nix18
-rw-r--r--pkgs/webapps/mantisbt_2/plugins/source-integration/Source.API.php.diff (renamed from nixops/modules/websites/tools/git/mantisbt/mantisbt-plugin-source-integration_Source.API.php.diff)0
-rw-r--r--pkgs/webapps/mantisbt_2/plugins/source-integration/default.nix21
15 files changed, 187 insertions, 168 deletions
diff --git a/nixops/modules/websites/tools/git/default.nix b/nixops/modules/websites/tools/git/default.nix
index dc44049..e7dbd6f 100644
--- a/nixops/modules/websites/tools/git/default.nix
+++ b/nixops/modules/websites/tools/git/default.nix
@@ -1,10 +1,11 @@
1{ lib, pkgs, config, myconfig, mylibs, ... }: 1{ lib, pkgs, config, myconfig, mylibs, ... }:
2let 2let
3 mantisbt = pkgs.callPackage ./mantisbt/mantisbt.nix { 3 mantisbt = pkgs.callPackage ./mantisbt.nix {
4 inherit (mylibs) fetchedGithub; 4 inherit (mylibs) fetchedGithub;
5 inherit (pkgs.webapps) mantisbt_2 mantisbt_2-plugins;
5 env = myconfig.env.tools.mantisbt; 6 env = myconfig.env.tools.mantisbt;
6 }; 7 };
7 gitweb = pkgs.callPackage ./gitweb/gitweb.nix { gitoliteDir = config.services.myGitolite.gitoliteDir; }; 8 gitweb = pkgs.callPackage ./gitweb.nix { gitoliteDir = config.services.myGitolite.gitoliteDir; };
8 9
9 cfg = config.services.myWebsites.tools.git; 10 cfg = config.services.myWebsites.tools.git;
10in { 11in {
diff --git a/nixops/modules/websites/tools/git/gitweb/gitweb.nix b/nixops/modules/websites/tools/git/gitweb.nix
index 2ee7a63..2ee7a63 100644
--- a/nixops/modules/websites/tools/git/gitweb/gitweb.nix
+++ b/nixops/modules/websites/tools/git/gitweb.nix
diff --git a/nixops/modules/websites/tools/git/mantisbt.nix b/nixops/modules/websites/tools/git/mantisbt.nix
new file mode 100644
index 0000000..36193a7
--- /dev/null
+++ b/nixops/modules/websites/tools/git/mantisbt.nix
@@ -0,0 +1,90 @@
1{ lib, env, mantisbt_2, mantisbt_2-plugins, writeText, stdenv, fetchurl, fetchedGithub }:
2rec {
3 keys = [{
4 dest = "webapps/tools-mantisbt";
5 user = apache.user;
6 group = apache.group;
7 permissions = "0400";
8 text = ''
9 <?php
10 $g_hostname = '${env.postgresql.socket}';
11 $g_db_username = '${env.postgresql.user}';
12 $g_db_password = '${env.postgresql.password}';
13 $g_database_name = '${env.postgresql.database}';
14 $g_db_type = 'pgsql';
15 $g_crypto_master_salt = '${env.master_salt}';
16 $g_allow_signup = OFF;
17 $g_allow_anonymous_login = ON;
18 $g_anonymous_account = 'anonymous';
19
20 $g_phpMailer_method = PHPMAILER_METHOD_SENDMAIL;
21 $g_smtp_host = 'localhost';
22 $g_smtp_username = ''';
23 $g_smtp_password = ''';
24 $g_webmaster_email = 'mantisbt@tools.immae.eu';
25 $g_from_email = 'mantisbt@tools.immae.eu';
26 $g_return_path_email = 'mantisbt@tools.immae.eu';
27 $g_from_name = 'Mantis Bug Tracker at git.immae.eu';
28 $g_email_receive_own = OFF;
29 # --- LDAP ---
30 $g_login_method = LDAP;
31 $g_ldap_protocol_version = 3;
32 $g_ldap_server = 'ldaps://ldap.immae.eu:636';
33 $g_ldap_root_dn = 'ou=users,dc=immae,dc=eu';
34 $g_ldap_bind_dn = 'cn=mantisbt,ou=services,dc=immae,dc=eu';
35 $g_ldap_bind_passwd = '${env.ldap.password}';
36 $g_use_ldap_email = ON;
37 $g_use_ldap_realname = ON;
38 $g_ldap_uid_field = 'uid';
39 $g_ldap_realname_field = 'cn';
40 $g_ldap_organization = '(memberOf=cn=users,cn=mantisbt,ou=services,dc=immae,dc=eu)';
41 '';
42 }];
43 webRoot = (mantisbt_2.override { mantis_config = "/var/secrets/webapps/tools-mantisbt"; }).withPlugins (builtins.attrValues mantisbt_2-plugins);
44 apache = rec {
45 user = "wwwrun";
46 group = "wwwrun";
47 modules = [ "proxy_fcgi" ];
48 webappName = "tools_mantisbt";
49 root = "/run/current-system/webapps/${webappName}";
50 vhostConf = ''
51 Alias /mantisbt "${root}"
52 <Directory "${root}">
53 DirectoryIndex index.php
54 <FilesMatch "\.php$">
55 SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost"
56 </FilesMatch>
57
58 AllowOverride All
59 Options FollowSymlinks
60 Require all granted
61 </Directory>
62 <Directory "${root}/admin">
63 #Reenable during upgrade
64 Require all denied
65 </Directory>
66 '';
67 };
68 phpFpm = rec {
69 serviceDeps = [ "postgresql.service" "openldap.service" ];
70 basedir = builtins.concatStringsSep ":" (
71 [ webRoot "/var/secrets/webapps/tools-mantisbt" ]
72 ++ webRoot.plugins);
73 socket = "/var/run/phpfpm/mantisbt.sock";
74 pool = ''
75 listen = ${socket}
76 user = ${apache.user}
77 group = ${apache.group}
78 listen.owner = ${apache.user}
79 listen.group = ${apache.group}
80 pm = ondemand
81 pm.max_children = 60
82 pm.process_idle_timeout = 60
83
84 php_admin_value[upload_max_filesize] = 5000000
85
86 php_admin_value[open_basedir] = "${basedir}:/tmp:/var/lib/php/sessions/mantisbt"
87 php_admin_value[session.save_path] = "/var/lib/php/sessions/mantisbt"
88 '';
89 };
90}
diff --git a/nixops/modules/websites/tools/git/mantisbt/mantisbt-plugin-slack.json b/nixops/modules/websites/tools/git/mantisbt/mantisbt-plugin-slack.json
deleted file mode 100644
index 54ea38b..0000000
--- a/nixops/modules/websites/tools/git/mantisbt/mantisbt-plugin-slack.json
+++ /dev/null
@@ -1,15 +0,0 @@
1{
2 "tag": "9286d2e-master",
3 "meta": {
4 "name": "mantisbt-plugin-slack",
5 "url": "https://github.com/mantisbt-plugins/Slack",
6 "branch": "master"
7 },
8 "github": {
9 "owner": "mantisbt-plugins",
10 "repo": "Slack",
11 "rev": "9286d2eeeb8a986ed949e378711fef5f0bf182dc",
12 "sha256": "0nn0v4jc967giilkzrppi5svd04m2hnals75xxp0iabcdjnih0mn",
13 "fetchSubmodules": true
14 }
15}
diff --git a/nixops/modules/websites/tools/git/mantisbt/mantisbt-plugin-source-integration.json b/nixops/modules/websites/tools/git/mantisbt/mantisbt-plugin-source-integration.json
deleted file mode 100644
index e36a68c..0000000
--- a/nixops/modules/websites/tools/git/mantisbt/mantisbt-plugin-source-integration.json
+++ /dev/null
@@ -1,15 +0,0 @@
1{
2 "tag": "v2.1.5",
3 "meta": {
4 "name": "mantisbt-plugin-source-integration",
5 "url": "https://github.com/mantisbt-plugins/source-integration",
6 "branch": "refs/tags/v2.1.5"
7 },
8 "github": {
9 "owner": "mantisbt-plugins",
10 "repo": "source-integration",
11 "rev": "a48039a20abc50864e0e68c0c843b27058404386",
12 "sha256": "07g6q3hivmnd94r47pp0snk5bv4pa3piwclc9qhj612i4wnsazsk",
13 "fetchSubmodules": true
14 }
15}
diff --git a/nixops/modules/websites/tools/git/mantisbt/mantisbt.nix b/nixops/modules/websites/tools/git/mantisbt/mantisbt.nix
deleted file mode 100644
index 41c5e90..0000000
--- a/nixops/modules/websites/tools/git/mantisbt/mantisbt.nix
+++ /dev/null
@@ -1,128 +0,0 @@
1{ lib, env, writeText, stdenv, fetchurl, fetchedGithub }:
2let
3 mantisbt = let
4 plugins = {
5 slack = stdenv.mkDerivation (fetchedGithub ./mantisbt-plugin-slack.json // rec {
6 installPhase = ''
7 sed -i -e "s/return '@' . \\\$username;/return \\\$username;/" Slack.php
8 cp -a . $out
9 '';
10 });
11 source-integration = stdenv.mkDerivation (fetchedGithub ./mantisbt-plugin-source-integration.json // rec {
12 installPhase = ''
13 mkdir $out
14 patch -p1 < ${./mantisbt-plugin-source-integration_Source.API.php.diff}
15 cp -a Source* $out/
16 '';
17 });
18 };
19 in rec {
20 keys = [{
21 dest = "webapps/tools-mantisbt";
22 user = apache.user;
23 group = apache.group;
24 permissions = "0400";
25 text = ''
26 <?php
27 $g_hostname = '${env.postgresql.socket}';
28 $g_db_username = '${env.postgresql.user}';
29 $g_db_password = '${env.postgresql.password}';
30 $g_database_name = '${env.postgresql.database}';
31 $g_db_type = 'pgsql';
32 $g_crypto_master_salt = '${env.master_salt}';
33 $g_allow_signup = OFF;
34 $g_allow_anonymous_login = ON;
35 $g_anonymous_account = 'anonymous';
36
37 $g_phpMailer_method = PHPMAILER_METHOD_SENDMAIL;
38 $g_smtp_host = 'localhost';
39 $g_smtp_username = ''';
40 $g_smtp_password = ''';
41 $g_webmaster_email = 'mantisbt@tools.immae.eu';
42 $g_from_email = 'mantisbt@tools.immae.eu';
43 $g_return_path_email = 'mantisbt@tools.immae.eu';
44 $g_from_name = 'Mantis Bug Tracker at git.immae.eu';
45 $g_email_receive_own = OFF;
46 # --- LDAP ---
47 $g_login_method = LDAP;
48 $g_ldap_protocol_version = 3;
49 $g_ldap_server = 'ldaps://ldap.immae.eu:636';
50 $g_ldap_root_dn = 'ou=users,dc=immae,dc=eu';
51 $g_ldap_bind_dn = 'cn=mantisbt,ou=services,dc=immae,dc=eu';
52 $g_ldap_bind_passwd = '${env.ldap.password}';
53 $g_use_ldap_email = ON;
54 $g_use_ldap_realname = ON;
55 $g_ldap_uid_field = 'uid';
56 $g_ldap_realname_field = 'cn';
57 $g_ldap_organization = '(memberOf=cn=users,cn=mantisbt,ou=services,dc=immae,dc=eu)';
58 '';
59 }];
60 webRoot = stdenv.mkDerivation rec {
61 name = "mantisbt-${version}";
62 version = "2.11.1";
63 src = fetchurl {
64 url = "https://downloads.sourceforge.net/project/mantisbt/mantis-stable/${version}/${name}.tar.gz";
65 sha256 = "0jnrqz6r2hf53v0k1lh3il7hlfiphn61r9wgg6mzyywkjxwq07md";
66 };
67 patches = [
68 ./patches/bug_report.php.diff
69 ./patches/bug_report_page.php.diff
70 ./patches/bugnote_add.php.diff
71 ./patches/bugnote_add_inc.php.diff
72 ];
73 installPhase = ''
74 cp -a . $out
75 ln -s /var/secrets/webapps/tools-mantisbt $out/config/config_inc.php
76 ln -s ${plugins.slack} $out/plugins/Slack
77 ln -s ${plugins.source-integration}/Source* $out/plugins/
78 '';
79 };
80 apache = rec {
81 user = "wwwrun";
82 group = "wwwrun";
83 modules = [ "proxy_fcgi" ];
84 webappName = "tools_mantisbt";
85 root = "/run/current-system/webapps/${webappName}";
86 vhostConf = ''
87 Alias /mantisbt "${root}"
88 <Directory "${root}">
89 DirectoryIndex index.php
90 <FilesMatch "\.php$">
91 SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost"
92 </FilesMatch>
93
94 AllowOverride All
95 Options FollowSymlinks
96 Require all granted
97 </Directory>
98 <Directory "${root}/admin">
99 #Reenable during upgrade
100 Require all denied
101 </Directory>
102 '';
103 };
104 phpFpm = rec {
105 serviceDeps = [ "postgresql.service" "openldap.service" ];
106 basedir = builtins.concatStringsSep ":" (
107 [ webRoot "/var/secrets/webapps/tools-mantisbt" ]
108 ++ lib.attrsets.mapAttrsToList (name: value: value) plugins);
109 socket = "/var/run/phpfpm/mantisbt.sock";
110 pool = ''
111 listen = ${socket}
112 user = ${apache.user}
113 group = ${apache.group}
114 listen.owner = ${apache.user}
115 listen.group = ${apache.group}
116 pm = ondemand
117 pm.max_children = 60
118 pm.process_idle_timeout = 60
119
120 php_admin_value[upload_max_filesize] = 5000000
121
122 php_admin_value[open_basedir] = "${basedir}:/tmp:/var/lib/php/sessions/mantisbt"
123 php_admin_value[session.save_path] = "/var/lib/php/sessions/mantisbt"
124 '';
125 };
126 };
127in
128 mantisbt
diff --git a/pkgs/webapps/default.nix b/pkgs/webapps/default.nix
index 50c3543..eb01a18 100644
--- a/pkgs/webapps/default.nix
+++ b/pkgs/webapps/default.nix
@@ -25,4 +25,12 @@ rec {
25 phpldapadmin = callPackage ./phpldapadmin {}; 25 phpldapadmin = callPackage ./phpldapadmin {};
26 26
27 rompr = callPackage ./rompr { inherit mylibs; }; 27 rompr = callPackage ./rompr { inherit mylibs; };
28
29 mantisbt_2 = callPackage ./mantisbt_2 {};
30 mantisbt_2-with-plugins = mantisbt_2.withPlugins (builtins.attrValues mantisbt_2-plugins);
31 mantisbt_2-plugins = let
32 names = [ "slack" "source-integration" ];
33 in
34 lib.attrsets.genAttrs names
35 (name: callPackage (./mantisbt_2/plugins + "/${name}") {});
28} 36}
diff --git a/nixops/modules/websites/tools/git/mantisbt/patches/bug_report.php.diff b/pkgs/webapps/mantisbt_2/bug_report.php.diff
index a520043..2924252 100644
--- a/nixops/modules/websites/tools/git/mantisbt/patches/bug_report.php.diff
+++ b/pkgs/webapps/mantisbt_2/bug_report.php.diff
@@ -1,8 +1,8 @@
1--- a/bug_report.php 2018-02-10 21:29:27.000000000 +0100 1--- a/bug_report.php 2019-05-06 12:06:44.265508011 +0200
2+++ b/bug_report.php 2018-03-03 15:04:19.622499678 +0100 2+++ b/bug_report.php 2019-05-06 12:09:40.106952738 +0200
3@@ -149,6 +149,17 @@ 3@@ -67,6 +67,17 @@
4 access_ensure_project_level( config_get( 'update_bug_assign_threshold' ) ); 4 'copy_files' => $f_copy_attachments_from_parent
5 } 5 );
6 6
7+# begin captcha check for anon user 7+# begin captcha check for anon user
8+if ( current_user_is_anonymous() && get_gd_version() > 0 ) { 8+if ( current_user_is_anonymous() && get_gd_version() > 0 ) {
@@ -15,6 +15,6 @@
15+ } 15+ }
16+} 16+}
17+ 17+
18 # if a profile was selected then let's use that information 18 if( $f_master_bug_id > 0 ) {
19 if( 0 != $t_bug_data->profile_id ) { 19 bug_ensure_exists( $f_master_bug_id );
20 if( profile_is_global( $t_bug_data->profile_id ) ) { 20
diff --git a/nixops/modules/websites/tools/git/mantisbt/patches/bug_report_page.php.diff b/pkgs/webapps/mantisbt_2/bug_report_page.php.diff
index 80dea91..80dea91 100644
--- a/nixops/modules/websites/tools/git/mantisbt/patches/bug_report_page.php.diff
+++ b/pkgs/webapps/mantisbt_2/bug_report_page.php.diff
diff --git a/nixops/modules/websites/tools/git/mantisbt/patches/bugnote_add.php.diff b/pkgs/webapps/mantisbt_2/bugnote_add.php.diff
index 4509f0a..4509f0a 100644
--- a/nixops/modules/websites/tools/git/mantisbt/patches/bugnote_add.php.diff
+++ b/pkgs/webapps/mantisbt_2/bugnote_add.php.diff
diff --git a/nixops/modules/websites/tools/git/mantisbt/patches/bugnote_add_inc.php.diff b/pkgs/webapps/mantisbt_2/bugnote_add_inc.php.diff
index a8589c7..a8589c7 100644
--- a/nixops/modules/websites/tools/git/mantisbt/patches/bugnote_add_inc.php.diff
+++ b/pkgs/webapps/mantisbt_2/bugnote_add_inc.php.diff
diff --git a/pkgs/webapps/mantisbt_2/default.nix b/pkgs/webapps/mantisbt_2/default.nix
new file mode 100644
index 0000000..3283a01
--- /dev/null
+++ b/pkgs/webapps/mantisbt_2/default.nix
@@ -0,0 +1,39 @@
1{ mantis_config ? "/etc/mantisbt/config_inc.php", stdenv, fetchurl }:
2let
3 withPlugins = plugins: package.overrideAttrs(old: {
4 name = "${old.name}-with-plugins";
5 installPhase = old.installPhase + (
6 builtins.concatStringsSep "\n" (
7 map (value: if builtins.hasAttr "selector" value then
8 "ln -sf ${value}/${value.selector} $out/plugins/"
9 else
10 "ln -sf ${value} $out/plugins/${value.pluginName}"
11 ) plugins
12 ));
13 passthru.plugins = plugins;
14 passthru.withPlugins = morePlugins: old.withPlugins (morePlugins ++ plugins);
15 });
16 package = stdenv.mkDerivation rec {
17 name = "mantisbt-${version}";
18 version = "2.21.0";
19 src = fetchurl {
20 url = "https://downloads.sourceforge.net/project/mantisbt/mantis-stable/${version}/${name}.tar.gz";
21 sha256 = "13lx569dp1gibq5daqp7dj6gsqic85rrix1s7xkp60gwpzk8wiw5";
22 };
23 patches = [
24 ./bug_report.php.diff
25 ./bug_report_page.php.diff
26 ./bugnote_add.php.diff
27 ./bugnote_add_inc.php.diff
28 ];
29 installPhase = ''
30 cp -a . $out
31 ln -s ${mantis_config} $out/config/config_inc.php
32 '';
33
34 passthru = {
35 plugins = [];
36 inherit withPlugins;
37 };
38 };
39in package
diff --git a/pkgs/webapps/mantisbt_2/plugins/slack/default.nix b/pkgs/webapps/mantisbt_2/plugins/slack/default.nix
new file mode 100644
index 0000000..61ed15f
--- /dev/null
+++ b/pkgs/webapps/mantisbt_2/plugins/slack/default.nix
@@ -0,0 +1,18 @@
1{ stdenv, fetchFromGitHub }:
2stdenv.mkDerivation rec {
3 passthru = {
4 pluginName = "Slack";
5 };
6 version = "9286d2e-master";
7 name = "mantisbt-plugin-slack-${version}";
8 src = fetchFromGitHub {
9 owner = "mantisbt-plugins";
10 repo = "Slack";
11 rev = "9286d2eeeb8a986ed949e378711fef5f0bf182dc";
12 sha256 = "0nn0v4jc967giilkzrppi5svd04m2hnals75xxp0iabcdjnih0mn";
13 };
14 installPhase = ''
15 sed -i -e "s/return '@' . \\\$username;/return \\\$username;/" Slack.php
16 cp -a . $out
17 '';
18}
diff --git a/nixops/modules/websites/tools/git/mantisbt/mantisbt-plugin-source-integration_Source.API.php.diff b/pkgs/webapps/mantisbt_2/plugins/source-integration/Source.API.php.diff
index c355144..c355144 100644
--- a/nixops/modules/websites/tools/git/mantisbt/mantisbt-plugin-source-integration_Source.API.php.diff
+++ b/pkgs/webapps/mantisbt_2/plugins/source-integration/Source.API.php.diff
diff --git a/pkgs/webapps/mantisbt_2/plugins/source-integration/default.nix b/pkgs/webapps/mantisbt_2/plugins/source-integration/default.nix
new file mode 100644
index 0000000..dc6c7de
--- /dev/null
+++ b/pkgs/webapps/mantisbt_2/plugins/source-integration/default.nix
@@ -0,0 +1,21 @@
1{ stdenv, fetchFromGitHub }:
2stdenv.mkDerivation rec {
3 version = "v2.2.0";
4 name = "mantisbt-plugin-source-integration-${version}";
5 src = fetchFromGitHub {
6 owner = "mantisbt-plugins";
7 repo = "source-integration";
8 rev = "44fc9e2e770aff4f40f56833f26a86ce0e2deb76";
9 sha256 = "0gcm6kqqijnv303sk59zn27adwx5vkr545mwzyaq2nrpxnkwdy5b";
10 };
11 patches = [
12 ./Source.API.php.diff
13 ];
14 installPhase = ''
15 mkdir $out
16 cp -a Source* $out/
17 '';
18 passthru = {
19 selector = "Source*";
20 };
21}