guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

03/03: berlin: Run a service for the GWL web site.


From: Ludovic Courtès
Subject: 03/03: berlin: Run a service for the GWL web site.
Date: Thu, 26 Sep 2019 04:42:48 -0400 (EDT)

civodul pushed a commit to branch master
in repository maintenance.

commit 52e2620436dd5d4e52831cdf7dca8be68babf3a2
Author: Ludovic Courtès <address@hidden>
Date:   Wed Sep 25 23:43:27 2019 +0200

    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.
---
 hydra/berlin.scm               |   3 +
 hydra/modules/sysadmin/web.scm | 124 ++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 126 insertions(+), 1 deletion(-)

diff --git a/hydra/berlin.scm b/hydra/berlin.scm
index 21a87bc..172c9cd 100644
--- a/hydra/berlin.scm
+++ b/hydra/berlin.scm
@@ -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")
diff --git a/hydra/modules/sysadmin/web.scm b/hydra/modules/sysadmin/web.scm
index 89753f8..aeb6ec9 100644
--- a/hydra/modules/sysadmin/web.scm
+++ b/hydra/modules/sysadmin/web.scm
@@ -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.")))
+



reply via email to

[Prev in Thread] Current Thread [Next in Thread]