]>
Commit | Line | Data |
---|---|---|
9d90e7e2 | 1 | { lib, env, writeText, stdenv, fetchurl, fetchedGithub }: |
50d8fa14 | 2 | let |
50d8fa14 IB |
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 | config = | |
5c101474 | 21 | writeText "config_inc.php" '' |
50d8fa14 | 22 | <?php |
7ebcaad5 IB |
23 | $g_hostname = '${env.postgresql.socket}'; |
24 | $g_db_username = '${env.postgresql.user}'; | |
9d90e7e2 | 25 | $g_db_password = '${env.postgresql.password}'; |
7ebcaad5 | 26 | $g_database_name = '${env.postgresql.database}'; |
50d8fa14 | 27 | $g_db_type = 'pgsql'; |
9d90e7e2 | 28 | $g_crypto_master_salt = '${env.master_salt}'; |
50d8fa14 IB |
29 | $g_allow_signup = OFF; |
30 | $g_allow_anonymous_login = ON; | |
31 | $g_anonymous_account = 'anonymous'; | |
32 | ||
591ebd87 IB |
33 | $g_phpMailer_method = PHPMAILER_METHOD_SENDMAIL; |
34 | $g_smtp_host = 'localhost'; | |
50d8fa14 IB |
35 | $g_smtp_username = '''; |
36 | $g_smtp_password = '''; | |
0f466f6d IB |
37 | $g_webmaster_email = 'mantisbt@tools.immae.eu'; |
38 | $g_from_email = 'mantisbt@tools.immae.eu'; | |
39 | $g_return_path_email = 'mantisbt@tools.immae.eu'; | |
40 | $g_from_name = 'Mantis Bug Tracker at git.immae.eu'; | |
50d8fa14 IB |
41 | $g_email_receive_own = OFF; |
42 | # --- LDAP --- | |
43 | $g_login_method = LDAP; | |
44 | $g_ldap_protocol_version = 3; | |
45 | $g_ldap_server = 'ldaps://ldap.immae.eu:636'; | |
46 | $g_ldap_root_dn = 'ou=users,dc=immae,dc=eu'; | |
47 | $g_ldap_bind_dn = 'cn=mantisbt,ou=services,dc=immae,dc=eu'; | |
9d90e7e2 | 48 | $g_ldap_bind_passwd = '${env.ldap.password}'; |
50d8fa14 IB |
49 | $g_use_ldap_email = ON; |
50 | $g_use_ldap_realname = ON; | |
51 | $g_ldap_uid_field = 'uid'; | |
52 | $g_ldap_realname_field = 'cn'; | |
53 | $g_ldap_organization = '(memberOf=cn=users,cn=mantisbt,ou=services,dc=immae,dc=eu)'; | |
54 | ''; | |
55 | webRoot = stdenv.mkDerivation rec { | |
56 | name = "mantisbt-${version}"; | |
57 | version = "2.11.1"; | |
58 | src = fetchurl { | |
59 | url = "https://downloads.sourceforge.net/project/mantisbt/mantis-stable/${version}/${name}.tar.gz"; | |
60 | sha256 = "0jnrqz6r2hf53v0k1lh3il7hlfiphn61r9wgg6mzyywkjxwq07md"; | |
61 | }; | |
62 | patches = [ | |
10889174 IB |
63 | ./patches/bug_report.php.diff |
64 | ./patches/bug_report_page.php.diff | |
65 | ./patches/bugnote_add.php.diff | |
66 | ./patches/bugnote_add_inc.php.diff | |
50d8fa14 IB |
67 | ]; |
68 | installPhase = '' | |
69 | cp -a . $out | |
70 | ln -s ${config} $out/config/config_inc.php | |
71 | ln -s ${plugins.slack} $out/plugins/Slack | |
72 | ln -s ${plugins.source-integration}/Source* $out/plugins/ | |
73 | ''; | |
74 | }; | |
a95ab089 | 75 | apache = rec { |
50d8fa14 IB |
76 | user = "wwwrun"; |
77 | group = "wwwrun"; | |
78 | modules = [ "proxy_fcgi" ]; | |
a95ab089 IB |
79 | webappName = "tools_mantisbt"; |
80 | root = "/run/current-system/webapps/${webappName}"; | |
50d8fa14 | 81 | vhostConf = '' |
a95ab089 IB |
82 | Alias /mantisbt "${root}" |
83 | <Directory "${root}"> | |
50d8fa14 IB |
84 | DirectoryIndex index.php |
85 | <FilesMatch "\.php$"> | |
86 | SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost" | |
87 | </FilesMatch> | |
88 | ||
89 | AllowOverride All | |
90 | Options FollowSymlinks | |
91 | Require all granted | |
92 | </Directory> | |
a95ab089 | 93 | <Directory "${root}/admin"> |
50d8fa14 IB |
94 | #Reenable during upgrade |
95 | Require all denied | |
96 | </Directory> | |
97 | ''; | |
98 | }; | |
99 | phpFpm = rec { | |
100 | basedir = builtins.concatStringsSep ":" ( | |
101 | [ webRoot config ] | |
5c101474 | 102 | ++ lib.attrsets.mapAttrsToList (name: value: value) plugins); |
50d8fa14 IB |
103 | socket = "/var/run/phpfpm/mantisbt.sock"; |
104 | pool = '' | |
105 | listen = ${socket} | |
106 | user = ${apache.user} | |
107 | group = ${apache.group} | |
108 | listen.owner = ${apache.user} | |
109 | listen.group = ${apache.group} | |
110 | pm = ondemand | |
111 | pm.max_children = 60 | |
112 | pm.process_idle_timeout = 60 | |
113 | ||
114 | php_admin_value[upload_max_filesize] = 5000000 | |
115 | ||
116 | php_admin_value[open_basedir] = "${basedir}:/tmp" | |
c8e019b6 | 117 | php_admin_value[session.save_path] = "/var/lib/php/sessions/mantisbt" |
50d8fa14 IB |
118 | ''; |
119 | }; | |
120 | }; | |
121 | in | |
122 | mantisbt |