aboutsummaryrefslogtreecommitdiff
path: root/pkgs/webapps/mantisbt_2/default.nix
blob: 5aa04d1b4574165bd07be60139a0d00dad2a67c3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
{ 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