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



                                                         








                                                                                                            
































                                                                           
{ lib, pkgs, config, myconfig, mylibs, ... }:
let
    mantisbt = pkgs.callPackage ./mantisbt/mantisbt.nix {
      inherit (mylibs) fetchedGithub;
      env = myconfig.env.tools.mantisbt;
    };
    gitweb = pkgs.callPackage ./gitweb/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 {
    security.acme.certs."eldiron".extraDomains."git.immae.eu" = null;

    nixpkgs.config.packageOverrides = oldpkgs: rec {
      gitweb = oldpkgs.gitweb.overrideAttrs(old: {
        installPhase = old.installPhase + ''
          cp -r ${./gitweb/theme} $out/gitweb-theme;
          '';
      });
    };

    services.myWebsites.tools.modules =
      gitweb.apache.modules ++
      mantisbt.apache.modules;

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