aboutsummaryrefslogtreecommitdiff
path: root/modules/private/websites/tools/git/default.nix
blob: 755bab005bbf8a1539094192fb94212821230297 (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
44
45
46
47
48
49
50
51
{ lib, pkgs, config, ... }:
let
    mantisbt = pkgs.callPackage ./mantisbt.nix {
      inherit (pkgs.webapps) mantisbt_2 mantisbt_2-plugins;
      env = config.myEnv.tools.mantisbt;
      inherit config;
    };
    gitweb = pkgs.callPackage ./gitweb.nix {
      gitoliteDir = config.myServices.gitolite.gitoliteDir;
    };

    cfg = config.myServices.websites.tools.git;
in {
  options.myServices.websites.tools.git = {
    enable = lib.mkEnableOption "enable git's website";
  };

  config = lib.mkIf cfg.enable {
    secrets.keys = mantisbt.keys;
    services.websites.env.tools.modules =
      gitweb.apache.modules ++
      mantisbt.apache.modules;
    services.websites.webappDirs."${gitweb.apache.webappName}" = gitweb.webRoot;
    services.websites.webappDirs."${mantisbt.apache.webappName}" = mantisbt.webRoot;

    system.activationScripts.mantisbt = mantisbt.activationScript;
    services.websites.env.tools.vhostConfs.git = {
      certName    = "eldiron";
      addToCerts  = true;
      hosts       = ["git.immae.eu" ];
      root        = gitweb.apache.root;
      extraConfig = [
        gitweb.apache.vhostConf
        (mantisbt.apache.vhostConf config.services.phpfpm.pools.mantisbt.socket)
        ''
          RewriteEngine on
          RewriteCond %{REQUEST_URI}       ^/releases
          RewriteRule /releases(.*)        https://release.immae.eu$1 [P,L]
          ''
      ];
    };
    services.phpfpm.pools = {
      mantisbt = {
        user = config.services.httpd.Tools.user;
        group = config.services.httpd.Tools.group;
        settings = mantisbt.phpFpm.pool;
        phpPackage = pkgs.php72;
      };
    };
  };
}