From fe282755ccb96a6153d8e3dba61ad67b14a03ec3 Mon Sep 17 00:00:00 2001
From: Arun Isaac
Date: Fri, 28 Mar 2025 04:26:38 +0000
Subject: forge: Make forge web listing optional.

* doc/forge.skb:
* guix/forge/forge.scm (<forge-configuration>)[web-domain]: Set
default to #f.
* guix/forge/forge.scm (forge-tissue-host): Rename to
forge-tissue-hosts. Return list of <tissue-host> objects.
(forge-service-type): Update call to forge-tissue-host. Add default
value.
---
 guix/forge/forge.scm | 43 +++++++++++++++++++++++++------------------
 1 file changed, 25 insertions(+), 18 deletions(-)

(limited to 'guix/forge')

diff --git a/guix/forge/forge.scm b/guix/forge/forge.scm
index 09f92c9..cfe8337 100644
--- a/guix/forge/forge.scm
+++ b/guix/forge/forge.scm
@@ -105,7 +105,8 @@
 (define-record-type* <forge-configuration>
   forge-configuration make-forge-configuration
   forge-configuration?
-  (web-domain forge-configuration-web-domain)
+  (web-domain forge-configuration-web-domain
+              (default #f))
   (projects forge-configuration-projects
             (default '())))
 
@@ -463,22 +464,27 @@ forge configuration @var{config}."
                       (root website-directory))))
               (forge-configuration-projects config)))
 
-(define (forge-tissue-host config)
-  "Return @code{<tissue-host>} object for forge configuration
+(define (forge-tissue-hosts config)
+  "Return list of @code{<tissue-host>} objects for forge configuration
 @var{config}."
-  (tissue-host
-   (name (forge-configuration-web-domain config))
-   (projects
-    (filter-map (lambda (project)
-                  (and (forge-project-tissue? project)
-                       (tissue-project
-                        (name (forge-project-name project))
-                        ;; The laminar user must own the host state so
-                        ;; that it can run tissue pull.
-                        (user "laminar")
-                        (upstream-repository
-                         (forge-project-repository project)))))
-                (forge-configuration-projects config)))))
+  (match-record config <forge-configuration>
+      (web-domain projects)
+      (if web-domain
+          (list (tissue-host
+                 (name web-domain)
+                 (projects
+                  (filter-map (lambda (project)
+                                (and (forge-project-tissue? project)
+                                     (tissue-project
+                                      (name (forge-project-name project))
+                                      ;; The laminar user must own the
+                                      ;; host state so that it can run
+                                      ;; tissue pull.
+                                      (user "laminar")
+                                      (upstream-repository
+                                       (forge-project-repository project)))))
+                              projects))))
+          (list))))
 
 (define (forge-ci-jobs config)
   "Return list of CI jobs for forge configuration @var{config}. Each
@@ -572,7 +578,7 @@ value is a list of @code{<webhook-hook>} objects."
                      (service-extension forge-nginx-service-type
                                         forge-nginx-server-blocks)
                      (service-extension tissue-service-type
-                                        (compose list forge-tissue-host))
+                                        forge-tissue-hosts)
                      (service-extension forge-laminar-service-type
                                         forge-ci-jobs+contexts+groups)
                      ;; TODO: Run CI job only if there are new commits
@@ -586,4 +592,5 @@ value is a list of @code{<webhook-hook>} objects."
              (forge-configuration
               (inherit config)
               (projects (append (forge-configuration-projects config)
-                                projects)))))))
+                                projects)))))
+   (default-value (forge-configuration))))
-- 
cgit v1.2.3