From 990454ec7eb549a0084ec7d88ba740ec796e2d02 Mon Sep 17 00:00:00 2001 From: Vineet Kumar Date: Tue, 19 May 2026 14:02:11 -0400 Subject: saklas: setup readonly git-http-backend for smart https cloning required by libgit2 since they're not fully compatible with main git like not supporting dumb cloning --- epistemia/systems/saklas.scm | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/epistemia/systems/saklas.scm b/epistemia/systems/saklas.scm index fa0fbc1..59c23b4 100644 --- a/epistemia/systems/saklas.scm +++ b/epistemia/systems/saklas.scm @@ -432,6 +432,20 @@ rpz: activation-service-type #~(when (file-exists? "/data/src/bare") (chmod "/data/src/bare" #o775))) + (simple-service 'git-mirror-update + shepherd-root-service-type + (list (shepherd-timer + '(git-mirror-update) + "0 */8 * * *" ; vixie cron doesn't support random/tilde. I'm sorry codeberg and other mirrors :( + #~("/run/privileged/bin/su" "git" "-c" + "for i in $(dirname $(grep -l Mirrors /data/src/bare/*.git/cgitrc)); do (cd \"$i\"; git fetch upstream --prune); done") + #:requirement '(networking) + #:documentation "Update git mirrors every 8 hours."))) + (service fcgiwrap-service-type + (fcgiwrap-configuration + (user "git") + (group "git") + (socket "tcp:127.0.0.1:9000"))) (service cgit-service-type (cgit-configuration (enable-index-links? #t) @@ -456,6 +470,19 @@ rpz: (raw-content (list "include" %nginx-badboi ";")) (locations (list + (nginx-location-configuration + (uri "~ \"^/(?.+?)(\\.git)?/(?(?:HEAD|info/refs|objects/(?:info/[^/]+|[0-9a-f]{2}/[0-9a-f]{38}|pack/pack-[0-9a-f]{40}\\.(?:pack|idx))|git-upload-pack))$\"") + (body (list #~(string-append "fastcgi_param SCRIPT_FILENAME " #$(file-append git "/libexec/git-core/git-http-backend") ";") + "fastcgi_param GIT_PROJECT_ROOT /data/src/bare;" + "fastcgi_param PATH_INFO /$repo.git/$gitpath;" + "fastcgi_param GIT_HTTP_EXPORT_ALL \"\";" + "fastcgi_param REMOTE_USER $remote_user;" + "fastcgi_param QUERY_STRING $args;" + "fastcgi_param REQUEST_METHOD $request_method;" + "fastcgi_param CONTENT_TYPE $content_type;" + "fastcgi_param CONTENT_LENGTH $content_length;" + "fastcgi_param HTTP_HOST $server_name;" + "fastcgi_pass 127.0.0.1:9000;"))) (nginx-location-configuration (uri "@cgit") (body '("fastcgi_param SCRIPT_FILENAME $document_root/lib/cgit/cgit.cgi;" -- cgit v1.2.3