about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2025-08-18 11:32:17 -0500
committerFrederick Muriuki Muriithi2025-08-18 14:47:52 -0500
commit62720f663c87826a888697936c608b890e1526f8 (patch)
tree70a416e9fba255c7514460e1350febec4deb9f39
parent4a50332e85181118c2f3b514f65e4c8238550238 (diff)
downloadgn-machines-main.tar.gz
gn-guile: Setup envvars for X.509 certificates. HEAD main
-rw-r--r--genenetwork/services/genenetwork.scm19
1 files changed, 15 insertions, 4 deletions
diff --git a/genenetwork/services/genenetwork.scm b/genenetwork/services/genenetwork.scm
index f551528..4aa35b9 100644
--- a/genenetwork/services/genenetwork.scm
+++ b/genenetwork/services/genenetwork.scm
@@ -623,11 +623,22 @@ a @code{<genenetwork-configuration>} record."
                                (build-xapian-index-cron-gexp config))
                #:user "root")))
 
-(define (gn-guile-gexp gn-guile-port) 
+(define (gn-guile-gexp gn-guile-port gn-guile-pkg)
   (with-imported-modules '((guix build utils))
     #~(begin
         (use-modules (guix build utils))
-        (let ((current-repo-path (string-append (getcwd) "/gn-docs")))
+        (let* ((gn-guile-profile #$(profile (content (package->development-manifest gn-guile-pkg))
+                                            (allow-collisions? #t)))
+               (ssl-cert-dir (string-append gn-guile-profile "/etc/ssl/certs"))
+               (ssl-cert-file (string-append ssl-cert-dir "/ca-certificates.crt"))
+               (current-repo-path (string-append (pk "CWD" (getcwd)) "/gn-docs")))
+          ;; These have to be setup manually here an not in the
+          ;; `gn-guile-shepherd-service' function, otherwise, they do not take
+          ;; effect for some reason.
+          (setenv "SSL_CERT_DIR" ssl-cert-dir)
+          (setenv "SSL_CERT_FILE" ssl-cert-file)
+          (setenv "GUILE_TLS_CERTIFICATE_DIRECTORY" ssl-cert-dir)
+
           (when (file-exists? current-repo-path)
             (delete-file-recursively current-repo-path))
           (setenv "CURRENT_REPO_PATH" current-repo-path)
@@ -638,7 +649,7 @@ a @code{<genenetwork-configuration>} record."
 
 (define (gn-guile-shepherd-service config)
   (match-record config <genenetwork-configuration>
-    (gn-doc-git-checkout gn-guile-port)
+    (gn-guile gn-doc-git-checkout gn-guile-port)
     (shepherd-service
      (documentation "Run gn-guile server.")
      (provision '(gn-guile))
@@ -654,7 +665,7 @@ a @code{<genenetwork-configuration>} record."
         #~(make-forkexec-constructor
 	   (list #$(least-authority-wrapper
                     (program-file "gn-guile"
-                                  (gn-guile-gexp gn-guile-port))
+                                  (gn-guile-gexp gn-guile-port gn-guile))
                     #:name "gn-guile-pola-wrapper"
                     #:directory (dirname gn-doc-git-checkout)
                     #:preserved-environment-variables