diff options
author | Arun Isaac | 2025-03-28 02:14:45 +0000 |
---|---|---|
committer | Arun Isaac | 2025-03-28 03:27:01 +0000 |
commit | 89014899cff3d48c518295912e373e27911fc4b6 (patch) | |
tree | e002d2729278d173a24927acc0978c005e0cdced | |
parent | 7519f07374cb7b617aa5efc30619e954fd260499 (diff) | |
download | guix-forge-89014899cff3d48c518295912e373e27911fc4b6.tar.gz guix-forge-89014899cff3d48c518295912e373e27911fc4b6.tar.lz guix-forge-89014899cff3d48c518295912e373e27911fc4b6.zip |
forge: Configure tissue for projects.
* guix/forge/forge.scm (<forge-project>)[tissue?]: New field.
(<forge-configuration>)[web-domain]: New field.
(forge-nginx-server-blocks): Do not serve website conventionally if
tissue is enabled.
(forge-tissue-host): New function.
(forge-service-type): Extend tissue-service-type. Do not set up a
default value.
* doc/forge.skb (Reference)[<forge-configuration>]: Document
web-domain.
[<forge-project>]: Document tissue?.
-rw-r--r-- | doc/forge.skb | 8 | ||||
-rw-r--r-- | guix/forge/forge.scm | 30 |
2 files changed, 35 insertions, 3 deletions
diff --git a/doc/forge.skb b/doc/forge.skb index 4134e70..6e20a67 100644 --- a/doc/forge.skb +++ b/doc/forge.skb @@ -516,6 +516,8 @@ gunicorn is run in])))))) (record-field "value" [Its value])) (record-documentation "guix/forge/forge.scm" '<forge-configuration> + (record-field "web-domain" + [Domain name to serve forge on]) (record-field "projects" [List of ,(record-ref "<forge-project>") objects describing projects managed by guix-forge])) @@ -541,6 +543,12 @@ ownership of its parent directory is granted to the ,(code "laminar") user. The idea is that the website is built by a Guix derivation as a store item and a symbolic link to that store item is created in the parent directory.]) + (record-field "tissue?" + [Does this project use ,(ref :url +"https://forge.systemreboot.net/tissue/" :text "tissue")? If so, it +will be served at ,(samp "/<name>/") on the ,(record-field-ref +"<forge-configuration>" "web-domain") configured in ,(record-ref +"<forge-configuration>").]) (record-field "ci-jobs" [List of ,(record-ref "<forge-laminar-job>") objects describing ,(abbr :short "CI" :long "continuous integration") jobs to diff --git a/guix/forge/forge.scm b/guix/forge/forge.scm index abd8a26..09f92c9 100644 --- a/guix/forge/forge.scm +++ b/guix/forge/forge.scm @@ -47,6 +47,7 @@ #:export (forge-service-type forge-configuration forge-configuration? + forge-configuration-web-domain forge-configuration-projects forge-project forge-project? @@ -57,6 +58,7 @@ forge-project-repository-branch forge-project-web-domain forge-project-website-directory + forge-project-tissue? forge-project-ci-jobs forge-project-ci-jobs-trigger forge-project-parallel-ci-job-runs @@ -85,6 +87,8 @@ (default #f)) (website-directory forge-project-website-directory (default #f)) + (tissue? forge-project-tissue? + (default #f)) (ci-jobs forge-project-ci-jobs (default '()) (thunked)) (ci-jobs-trigger forge-project-ci-jobs-trigger ; one of 'post-receive-hook, 'cron, 'webhook @@ -101,6 +105,7 @@ (define-record-type* <forge-configuration> forge-configuration make-forge-configuration forge-configuration? + (web-domain forge-configuration-web-domain) (projects forge-configuration-projects (default '()))) @@ -447,16 +452,34 @@ that were built." "Return list of @code{<nginx-server-configuration>} extensions for forge configuration @var{config}." ;; Configure nginx server blocks for projects that have a web domain - ;; and a website directory. + ;; and a website directory, but do not have tissue enabled. (filter-map (match-record-lambda <forge-project> (web-domain website-directory tissue?) (and web-domain website-directory + (not tissue?) (nginx-server-configuration (server-name (list web-domain)) (root website-directory)))) (forge-configuration-projects config))) +(define (forge-tissue-host config) + "Return @code{<tissue-host>} object 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))))) + (define (forge-ci-jobs config) "Return list of CI jobs for forge configuration @var{config}. Each value of the returned list is a @code{<forge-laminar-job>} object." @@ -548,6 +571,8 @@ value is a list of @code{<webhook-hook>} objects." forge-activation) (service-extension forge-nginx-service-type forge-nginx-server-blocks) + (service-extension tissue-service-type + (compose list forge-tissue-host)) (service-extension forge-laminar-service-type forge-ci-jobs+contexts+groups) ;; TODO: Run CI job only if there are new commits @@ -561,5 +586,4 @@ value is a list of @code{<webhook-hook>} objects." (forge-configuration (inherit config) (projects (append (forge-configuration-projects config) - projects))))) - (default-value (forge-configuration)))) + projects))))))) |