summaryrefslogtreecommitdiff
path: root/config/services/web/git/default.nix
blob: bd8c128af1b4d8fe4581fa1004af29835077957b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
{ config, pkgs, ... }:
{
  services.nginx = {
    additionalModules = [ pkgs.nginxModules.subsFilter ];
    virtualHosts.git = {
      serverName = "git.${config.networking.domain}";
      enableACME = true;
      forceSSL = true;
      locations."/" = {
        proxyPass = "http://hephaistos.aristote.mesh/git/";
        extraConfig = ''
          proxy_redirect default;
          # fix internal hyperlinks
          proxy_set_header Accept-Encoding "";
          subs_filter "href='/git/" "href='/";
          subs_filter "action='/git/" "action='/";
          subs_filter "href='/([^/]*)/([^/]*)/'" "href=/$1/$2/tree/" r;
        '';
      };
    };
  };
}