aboutsummaryrefslogblamecommitdiff
path: root/pkgs/webapps/mantisbt_2/default.nix
blob: 5aa04d1b4574165bd07be60139a0d00dad2a67c3 (plain) (tree)
1
2
                                                                                      
   



















                                                                                                              

















                                                                                                         
                                     

          
{ mantis_config ? "/etc/mantisbt/config_inc.php", stdenv, fetchurl, lib, callPackage}:
let
  pluginNames = [ "slack" "source-integration" ];
  allPlugins = lib.attrsets.genAttrs pluginNames
    (name: callPackage (./plugins + "/${name}") {});
  toPassthru = pkg: plugins: {
    inherit plugins allPlugins;
    withPlugins = withPlugins pkg;
  };
  withPlugins = pkg: toPlugins:
    let
      plugins = toPlugins allPlugins;
      toInstallPlugin = n:
        if builtins.hasAttr "selector" n then
          "ln -sf ${n}/${n.selector} $out/plugins/"
        else
          "ln -sf ${n} $out/plugins/${n.pluginName}";
      newMantisbt = pkg.overrideAttrs(old: {
        installPhase = old.installPhase + "\n" + builtins.concatStringsSep "\n" (map toInstallPlugin plugins);
        passthru = toPassthru newMantisbt (pkg.plugins ++ plugins);
      });
    in newMantisbt;
  package = stdenv.mkDerivation rec {
    name = "mantisbt-${version}";
    version = "2.21.0";
    src = fetchurl {
      url = "https://downloads.sourceforge.net/project/mantisbt/mantis-stable/${version}/${name}.tar.gz";
      sha256 = "13lx569dp1gibq5daqp7dj6gsqic85rrix1s7xkp60gwpzk8wiw5";
    };
    patches = [
      ./bug_report.php.diff
      ./bug_report_page.php.diff
      ./bugnote_add.php.diff
      ./bugnote_add_inc.php.diff
    ];
    installPhase = ''
    cp -a . $out
    ln -s ${mantis_config} $out/config/config_inc.php
    '';

    passthru = toPassthru package [];
  };
in package