Subject: [bug#77186] [PATCH v2 03/14] services: gitolite-rc-file: Add host-name field.

From: Tomas Volf <[email-masked]>
Date: Tue, 1 Apr 2025 00:10:09 +0200

* gnu/services/version-control.scm (<gitolite-rc-file>): Add host-name field.
(gitolite-rc-file-compiler): Handle it during configuration file generation.
* doc/guix.texi (Version Control Services): Document it.

Change-Id: I1231ed47a294ff48b35a301f76ae8e9cbfcd9b95
---
 doc/guix.texi                    | 4 ++++
 gnu/services/version-control.scm | 8 +++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index bc8e7206d5..4daeab924b 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -41068,6 +41068,10 @@ Version Control Services
 value from gitolite however is @code{1} (written as @code{#t} in this
 configuration).
 
+@item @code{host-name} (default: @code{#f})
+The host name of this gitolite instance.  It is used by the mirroring
+feature.
+
 @item @code{roles} (default: @code{'(("READERS" . 1) ("WRITERS" . ))})
 Set the role names allowed to be used by users running the perms command.
 
diff --git a/gnu/services/version-control.scm b/gnu/services/version-control.scm
index 344538a73e..2b99e8db86 100644
--- a/gnu/services/version-control.scm
+++ b/gnu/services/version-control.scm
@@ -61,6 +61,7 @@ (define-module (gnu services version-control)
             gitolite-rc-file-unsafe-pattern
             gitolite-rc-file-git-config-keys
             gitolite-rc-file-log-extra
+            gitolite-rc-file-host-name
             gitolite-rc-file-roles
             gitolite-rc-file-enable
 
@@ -255,6 +256,8 @@ (define-record-type* <gitolite-rc-file>
                    (default ""))
   (log-extra       gitolite-rc-file-log-extra
                    (default #f))
+  (host-name       gitolite-rc-file-host-name
+                   (default #f))
   (roles           gitolite-rc-file-roles
                    (default '(("READERS" . 1)
                               ("WRITERS" . 1))))
@@ -273,7 +276,7 @@ (define-gexp-compiler (gitolite-rc-file-compiler
                        (file <gitolite-rc-file>) system target)
   (match-record file <gitolite-rc-file>
                 ( umask local-code unsafe-pattern git-config-keys log-extra
-                  roles enable)
+                  host-name roles enable)
     (apply text-file* "gitolite.rc"
            `("%RC = (\n"
              "    UMASK => " ,(format #f "~4,'0o" umask) ",\n"
@@ -284,6 +287,9 @@ (define-gexp-compiler (gitolite-rc-file-compiler
              ,(if log-extra
                   "    LOG_EXTRA => 1,\n"
                   "")
+             ,(if host-name
+                  (simple-format #f "    HOSTNAME => \"~A\",\n" host-name)
+                  "")
              "    ROLES => {\n"
              ,@(map (match-lambda
                       ((role . value)
-- 
2.49.0