about summary refs log tree commit diff
diff options
context:
space:
mode:
authorArun Isaac2022-06-09 18:29:34 +0530
committerArun Isaac2022-06-09 19:06:00 +0530
commit74ed989bbc9106a4db35dff0103dc99baf071f1e (patch)
treed0b5becc88156d2735462a0404a90e68e47fb4e3
parent284cab7bfb3dcf8027781d227c879d9b1ed9d746 (diff)
downloadgn-machines-74ed989bbc9106a4db35dff0103dc99baf071f1e.tar.gz
Link to issue tracker from Laminar page.
* genenetwork-development.scm: Import tar from (gnu packages base) and
gzip from (gnu packages compression).
(laminar-template-gexp, install-laminar-template-gexp): New functions.
(operating-system)[services]: Add install-laminar-template service.
-rw-r--r--genenetwork-development.scm44
1 files changed, 43 insertions, 1 deletions
diff --git a/genenetwork-development.scm b/genenetwork-development.scm
index 801bada..a84edff 100644
--- a/genenetwork-development.scm
+++ b/genenetwork-development.scm
@@ -23,12 +23,13 @@
              ((gn packages quality-control) #:select (sbcl-qc))
              (gn services databases)
              ((gnu packages admin) #:select (shepherd))
-             ((gnu packages base) #:select (gnu-make))
+             ((gnu packages base) #:select (gnu-make tar))
              ((gnu packages bash) #:select (bash))
              ((gnu packages bioinformatics) #:select (ccwl) #:prefix guix:)
              ((gnu packages certs) #:select (nss-certs))
              ((gnu packages check) #:select (python-pylint))
              ((gnu packages ci) #:select (laminar))
+             ((gnu packages compression) #:select (gzip))
              ((gnu packages databases) #:select (virtuoso-ose))
              ((gnu packages gnupg) #:select (guile-gcrypt))
              ((gnu packages graphviz) #:select (graphviz))
@@ -656,6 +657,41 @@ command to be executed."
 ;;; operating-system definition
 ;;;
 
+(define (laminar-template-gexp issue-tracker-uri)
+  "Return a G-expression that creates a custom Laminar template with a
+menu link to the issue tracker at ISSUE-TRACKER-URI."
+  (with-imported-modules '((guix build utils))
+    #~(begin
+        (use-modules (guix build utils))
+
+        (set-path-environment-variable "PATH"
+                                       (list "bin")
+                                       (list #$gzip #$tar))
+        (invoke "tar" "--extract" "--strip-components=3"
+                (string-append "--file=" #$(package-source laminar))
+                (string-append "laminar-"
+                               #$(package-version laminar)
+                               "/src/resources/index.html"))
+        (copy-file "index.html" #$output)
+        (substitute* #$output
+          (("<router-link to=\"jobs\">Jobs</router-link>" all)
+           (string-append all
+                          "<a href=\"" #$issue-tracker-uri "\" target=\"_blank\">Issue tracker</a>"))))))
+
+(define (install-laminar-template-gexp template)
+  "Return a G-expression that installs custom laminar TEMPLATE."
+  (with-imported-modules '((guix build utils))
+    #~(begin
+        (use-modules (guix build utils))
+
+        (define (switch-symlinks link target)
+          (let ((pivot (string-append link ".new")))
+            (symlink target pivot)
+            (rename-file pivot link)))
+
+        (mkdir-p "/var/lib/laminar/custom")
+        (switch-symlinks "/var/lib/laminar/custom/index.html" #$template))))
+
 (operating-system
   (host-name "genenetwork-development")
   (timezone "UTC")
@@ -683,6 +719,12 @@ command to be executed."
                             (laminar-configuration
                              (title "GeneNetwork CI")
                              (bind-http "localhost:9090")))
+                   (simple-service 'install-laminar-template
+                                   activation-service-type
+                                   (install-laminar-template-gexp
+                                    (computed-file
+                                     "laminar-template.html"
+                                     (laminar-template-gexp "https://issues.genenetwork.org"))))
                    (service webhook-service-type
                             (webhook-configuration
                              (port 9091)))