commit 93aeb37cafb333d7ee08784abde84db65b5ce713
parent c8f50f70a4cae45a7b54db0f35e1b2f4529b9067
Author: Luke Willis <lukejw@monastech.xyz>
Date: Sun, 8 Mar 2026 22:06:55 -0400
services: Add support for setting owner and description information with gitolite
Diffstat:
2 files changed, 31 insertions(+), 6 deletions(-)
diff --git a/mt/services/version-control.scm b/mt/services/version-control.scm
@@ -117,6 +117,7 @@ protocol.")
(stylesheet stagit-configuration-stylesheet ;file-like
(default (plain-file "style.css"
"\n")))
+ (clone-domain stagit-configuration-clone-domain) ;string
(admin-pubkey stagit-configuration-admin-pubkey)) ;file-like
;; Activation-time setup for stagit.
@@ -125,14 +126,16 @@ protocol.")
(define (stagit-activation config)
(let* ((package (stagit-configuration-package config))
(www-home (stagit-configuration-www-home config))
+ (gitolite-home (stagit-configuration-gitolite-home config))
(logo (stagit-configuration-logo config))
(stylesheet (stagit-configuration-stylesheet config))
- (gitolite-home (stagit-configuration-gitolite-home config))
+ (clone-domain (stagit-configuration-clone-domain config))
(gitolite-hooks (string-append gitolite-home "/local/hooks/common"))
(git-home (string-append gitolite-home "/repositories"))
(post-receive (create-stagit-hook package
www-home
- git-home)))
+ git-home
+ clone-domain)))
#~(begin
(use-modules (ice-9 match))
@@ -182,10 +185,12 @@ protocol.")
(define* (create-stagit-hook stagit
www-home
- git-home)
+ git-home
+ clone-domain)
(program-file "post-receive"
#~(begin
- (use-modules (ice-9 ftw))
+ (use-modules (ice-9 ftw)
+ (ice-9 rdelim))
;; Ignore private repositories.
(if (not (file-exists? "git-daemon-export-ok"))
@@ -193,11 +198,29 @@ protocol.")
;; Set correct file permissions.
(umask #o022)
+
+ (call-with-input-file "config"
+ (lambda (file)
+ (while #t (let ((line (read-line file)))
+ (if (eof-object? line) (break))
+ (if (string-prefix? "\tdescription" line)
+ (call-with-output-file "description"
+ (lambda (out)
+ (display (string-drop line 15) out))))
+ (if (string-prefix? "\towner" line)
+ (call-with-output-file "owner"
+ (lambda (out)
+ (display (string-drop line 9) out))))))))
+
;; Generate repository-specific content.
(let* ((src (getcwd))
(name (basename src ".git"))
(dest (string-append #$www-home "/" name)))
+ (call-with-output-file "url"
+ (lambda (out)
+ (display (string-append "git://" #$clone-domain
+ "/" name) out)))
(display "[stagit] Building ")
(display dest)
(display "\n")
@@ -238,7 +261,8 @@ protocol.")
(rc-file
(gnu:gitolite-rc-file
;; Use the hooks generated by the activation script
- (local-code "$ENV{HOME}/local")))))
+ (local-code "$ENV{HOME}/local")
+ (git-config-keys "gitweb\\.description gitweb\\.owner")))))
(service git-daemon-service-type
(git-daemon-configuration
(base-path (string-append (stagit-configuration-gitolite-home stagit-configuration)
diff --git a/mt/system/andrew.scm b/mt/system/andrew.scm
@@ -119,7 +119,8 @@ Welcome to \"andrew\" the, first MonasTech server.
(www-home "/var/www/git.monastech.xyz")
(admin-pubkey (plain-file
"lukejw.pub"
- "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEZ2qcwpwPdMmrXNrrqjqtuBw8lG9gxlAE+vwcZAHM3L lukejw@moses"))))
+ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEZ2qcwpwPdMmrXNrrqjqtuBw8lG9gxlAE+vwcZAHM3L lukejw@moses"))
+ (clone-domain "monastech.xyz")))
%mt-bishop-services))))
andrew-os