{ lib, checkEnv, writeText, stdenv, fetchurl, fetchedGithub }:
let
# FIXME: check that source-integration and slack still work
mantisbt = let
plugins = {
slack = stdenv.mkDerivation (fetchedGithub ./mantisbt-plugin-slack.json // rec {
installPhase = ''
sed -i -e "s/return '@' . \\\$username;/return \\\$username;/" Slack.php
cp -a . $out
'';
});
source-integration = stdenv.mkDerivation (fetchedGithub ./mantisbt-plugin-source-integration.json // rec {
installPhase = ''
mkdir $out
patch -p1 < ${./mantisbt-plugin-source-integration_Source.API.php.diff}
cp -a Source* $out/
'';
});
};
in rec {
config =
assert checkEnv "NIXOPS_MANTISBT_DB_PASSWORD";
assert checkEnv "NIXOPS_MANTISBT_MASTER_SALT";
assert checkEnv "NIXOPS_MANTISBT_LDAP_PASSWORD";
writeText "config_inc.php" ''
DirectoryIndex index.php
SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost"
AllowOverride All
Options FollowSymlinks
Require all granted
#Reenable during upgrade
Require all denied
'';
};
phpFpm = rec {
basedir = builtins.concatStringsSep ":" (
[ webRoot config ]
++ lib.attrsets.mapAttrsToList (name: value: value) plugins);
socket = "/var/run/phpfpm/mantisbt.sock";
pool = ''
listen = ${socket}
user = ${apache.user}
group = ${apache.group}
listen.owner = ${apache.user}
listen.group = ${apache.group}
pm = ondemand
pm.max_children = 60
pm.process_idle_timeout = 60
php_admin_value[upload_max_filesize] = 5000000
php_admin_value[open_basedir] = "${basedir}:/tmp"
php_admin_value[session.save_path] = "/var/lib/php/sessions/mantisbt"
'';
};
};
in
mantisbt