aboutsummaryrefslogblamecommitdiff
path: root/nixops/modules/websites/tools/git/default.nix
blob: 495c5eace0c7c6da9db8a8f4dc0d7a2b0be6fe98 (plain) (tree)
1
2
3
4
5
6
7
                                     
   
                                                
                                                           

                                        
                                                                                                     







                                                       
                                 
                                     

                              




                                                                          
 
                                              
                              
                         
                                      
                                       









                                                                           
                                   



                                      
{ lib, pkgs, config, myconfig, ... }:
let
    mantisbt = pkgs.callPackage ./mantisbt.nix {
      inherit (pkgs.webapps) mantisbt_2 mantisbt_2-plugins;
      env = myconfig.env.tools.mantisbt;
    };
    gitweb = pkgs.callPackage ./gitweb.nix { gitoliteDir = config.services.myGitolite.gitoliteDir; };

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

  config = lib.mkIf cfg.enable {
    secrets.keys = mantisbt.keys;
    services.websites.tools.modules =
      gitweb.apache.modules ++
      mantisbt.apache.modules;
    system.extraSystemBuilderCmds = ''
      mkdir -p $out/webapps
      ln -s ${gitweb.webRoot} $out/webapps/${gitweb.apache.webappName}
      ln -s ${mantisbt.webRoot} $out/webapps/${mantisbt.apache.webappName}
      '';

    services.websites.tools.vhostConfs.git = {
      certName    = "eldiron";
      addToCerts  = true;
      hosts       = ["git.immae.eu" ];
      root        = gitweb.apache.root;
      extraConfig = [
        gitweb.apache.vhostConf
        mantisbt.apache.vhostConf
        ''
          RewriteEngine on
          RewriteCond %{REQUEST_URI}       ^/releases
          RewriteRule /releases(.*)        https://release.immae.eu$1 [P,L]
          ''
      ];
    };
    services.phpfpm.poolConfigs = {
      mantisbt = mantisbt.phpFpm.pool;
    };
  };
}