2
0
Fork 0
mirror of git://git.savannah.gnu.org/guix/maintenance.git synced 2023-12-14 03:33:04 +01:00

berlin: Run a service for the GWL web site.

* hydra/modules/sysadmin/web.scm (gwl-snapshot): New variable.
(gwl-web-shepherd-service): New procedure.
(%gwl-web-accounts, gwl-web-service-type): New variables.
* hydra/berlin.scm (services): Add 'gwl-web-service-type' instance.
This commit is contained in:
Ludovic Courtès 2019-09-25 23:43:27 +02:00
parent e86c686b60
commit 52e2620436
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
2 changed files with 126 additions and 1 deletions

View file

@ -255,6 +255,9 @@ fastcgi_param PHP_VALUE \"post_max_size = 16M
(environment-variables
'(("GUIX_WEB_SITE_URL" . "/")))))
;; GWL web site.
(service gwl-web-service-type)
(frontend-services %sysadmins
#:systems '("x86_64-linux" "i686-linux"
"aarch64-linux")

View file

@ -18,11 +18,21 @@
(define-module (sysadmin web)
#:use-module (guix git)
#:use-module (guix gexp)
#:use-module (guix modules)
#:use-module (guix packages)
#:use-module (guix records)
#:use-module (guix git-download)
#:use-module (gnu packages)
#:use-module (gnu packages autotools)
#:use-module (gnu packages graphviz)
#:use-module (gnu packages guile)
#:use-module (gnu packages guile-xyz)
#:use-module (gnu packages package-management)
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages texinfo)
#:use-module (gnu services)
#:use-module (gnu services mcron)
#:use-module (gnu services shepherd)
#:use-module (gnu services web)
#:use-module (gnu system shadow)
#:use-module (ice-9 match)
@ -31,7 +41,9 @@
static-web-site-configuration
static-web-site-configuration?
static-web-site-service-type))
static-web-site-service-type
gwl-web-service-type))
(define guix-extensions
(match (package-transitive-propagated-inputs
@ -170,3 +182,113 @@ that's built with Haunt or similar."
(description
"Update and publish a web site that is built from source
taken from a Git repository.")))
;;;
;;; Guix Worflow Language.
;;;
(define gwl-snapshot
;; GWL snapshot supposedly more recent than the latest release.
(let ((commit "044a76cb59ae5609b5ef882f81fd29f8859b6a9c")
(revision "1"))
(package
(inherit gwl)
(version (git-version (package-version gwl)
revision commit))
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://git.savannah.gnu.org/git/gwl.git")
(commit commit)))
(file-name (git-file-name "gwl" version))
(sha256
(base32
"17mr5mniijg81ysdf95i2d8j5hccwcz6swmypdj4hh514i378c4q"))
(modules '((guix build utils)))
(snippet
;; Install examples in the right place, without repeating
;; "doc/examples".
'(substitute* "Makefile.am"
(("nobase_dist_examples_DATA")
"dist_examples_DATA")))))
(native-inputs
`(("autoconf" ,autoconf)
("automake" ,automake)
("pkg-config" ,pkg-config)
("graphviz" ,graphviz)
("texinfo" ,texinfo)))
(inputs
`(("guile" ,guile-2.2)))
(propagated-inputs
`(("guix" ,guix)
("guile-commonmark" ,guile-commonmark)
("guile-wisp" ,guile-wisp)
("guile-syntax-highlight" ,guile-syntax-highlight)))
;; XXX: Go figure why tests fail.
(arguments '(#:tests? #f)))))
(define (gwl-web-shepherd-service gwl)
(define gwl+deps
(match (package-transitive-propagated-inputs gwl)
(((labels packages) ...)
(cons gwl packages))))
(define wrapped-guix
(program-file "guix-workflow"
#~(begin
(setenv "GUILE_LOAD_PATH"
(string-join '#$gwl+deps
(string-append
"/share/guile/site/"
(effective-version) ":")
'suffix))
(setenv "GUILE_LOAD_COMPILED_PATH"
(string-join '#$gwl+deps
(string-append
"/lib/guile/"
(effective-version)
"/site-ccache:")
'suffix))
(apply execl
#$(file-append guix "/bin/guix")
(command-line)))))
(with-imported-modules (source-module-closure
'((gnu build shepherd)
(gnu system file-systems)))
(list (shepherd-service
(provision '(gwl-web))
(requirement '(user-processes networking))
(documentation "Run the dicod daemon.")
(modules '((gnu build shepherd)
(gnu system file-systems)))
(start #~(make-forkexec-constructor/container
(list #$wrapped-guix "workflow" "--web-interface")
#:user "gwl-web"
#:group "gwl-web"))
(stop #~(make-kill-destructor))))))
(define %gwl-web-accounts
(list (user-account
(name "gwl-web")
(system? #t)
(home-directory "/var/empty")
(group "gwl-web"))
(user-group
(name "gwl-web")
(system? #t))))
(define gwl-web-service-type
(service-type
(name 'gwl-web)
(extensions
(list (service-extension shepherd-root-service-type
gwl-web-shepherd-service)
(service-extension account-service-type
(const %gwl-web-accounts))))
(default-value gwl-snapshot)
(description
"Run @command{guix worflow --web}, which serves the Guix Workflow
Language (GWL) web site.")))