summaryrefslogtreecommitdiffstats
path: root/krebs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2020-07-07 22:08:48 +0200
committertv <tv@krebsco.de>2020-07-07 22:08:48 +0200
commite26705c2deb776ff00a9963e8834fe26572db1f7 (patch)
treef56aa82e3a6da89a82e4c25edecfc42c1944c048 /krebs
parent495871f182ff27dbd6f00b053f729f7a40c570c9 (diff)
git: support smart HTTP transport
Diffstat (limited to 'krebs')
-rw-r--r--krebs/3modules/git.nix10
1 files changed, 10 insertions, 0 deletions
diff --git a/krebs/3modules/git.nix b/krebs/3modules/git.nix
index 895d9b3b6..b2d2ec6cc 100644
--- a/krebs/3modules/git.nix
+++ b/krebs/3modules/git.nix
@@ -452,6 +452,16 @@ let
fastcgi_param HTTP_HOST $server_name;
fastcgi_pass unix:${config.services.fcgiwrap.socketAddress};
'';
+ # Smart HTTP transport. Regex based on.
+ # https://github.com/git/git/blob/v2.27.0/http-backend.c#L708-L721
+ locations.''~ "^/[0-9A-Za-z._-]+/(HEAD|info/refs|objects/info/(alternates|http-alternates|packs)|[0-9a-f]{2}/([0-9a-f]{38}|[0-9a-f]{62})|pack/pack-([0-9a-f]{40}|[0-9a-f]{64})\.(pack|idx)|git-upload-pack|git-receive-pack)$"''.extraConfig = ''
+ include ${pkgs.nginx}/conf/fastcgi_params;
+ fastcgi_param GIT_HTTP_EXPORT_ALL "";
+ fastcgi_param GIT_PROJECT_ROOT ${cfg.dataDir};
+ fastcgi_param PATH_INFO $fastcgi_script_name;
+ fastcgi_param SCRIPT_FILENAME ${pkgs.git}/bin/git-http-backend;
+ fastcgi_pass unix:${config.services.fcgiwrap.socketAddress};
+ '';
locations."/static/".extraConfig = ''
root ${pkgs.cgit}/cgit;
rewrite ^/static(/.*)$ $1 break;