about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--genenetwork-development.scm64
1 files changed, 53 insertions, 11 deletions
diff --git a/genenetwork-development.scm b/genenetwork-development.scm
index f707241..428788e 100644
--- a/genenetwork-development.scm
+++ b/genenetwork-development.scm
@@ -633,17 +633,59 @@ server described by CONFIG, a <genenetwork-configuration> object."
                         "gn_auth.wsgi:app"))))))))
 
 (define (gn-guile-gexp gn-guile-port)
-  (with-imported-modules '((guix build utils))
-    #~(begin
-        (use-modules (guix build utils))
-        (let ((current-repo-path (string-append (getcwd) "/gn-docs")))
-          (when (file-exists? current-repo-path)
-            (delete-file-recursively current-repo-path))
-          (setenv "CURRENT_REPO_PATH" current-repo-path)
-          (invoke #$(file-append git-minimal "/bin/git")
-                  "clone" "--depth" "1" (getenv "CGIT_REPO_PATH")))
-        (invoke #$(file-append gn-guile "/bin/gn-guile")
-                (number->string #$gn-guile-port)))))
+  (with-packages
+   (list coreutils git-minimal nss-certs)
+   (with-imported-modules '((guix build utils))
+     #~(begin
+         (use-modules (guix build utils))
+
+         (define (hline)
+           "Print a horizontal line 50 '=' characters long."
+           (display (make-string 50 #\=))
+           (newline)
+           (force-output))
+
+         (define (show-head-commit)
+           (hline)
+           (invoke "git" "log" "--max-count" "1")
+           (hline))
+         ;; KLUDGE: Here we set all the certificates properly.  In gn-guile,
+         ;; we make request to external services.  Here's an example:
+         ;; curl http://localhost:8091/gene/aliases/Shh
+         ;;
+         ;; Without certs, we run into:
+         ;; 2025-07-22 08:27:11 GET /gene/aliases/Shh
+         ;; [...]
+         ;; 2025-07-22 08:27:19   signer-not-found invalid
+         (setenv "GN_GUILE_PROFILE" #$(profile
+                                       (content (package->development-manifest gn-guile))
+                                       (allow-collisions? #t)))
+         (setenv "SSL_CERT_DIR" (string-append
+                                 (getenv "GN_GUILE_PROFILE")
+                                 "/etc/ssl/certs"))
+         (setenv "SSL_CERT_FILE" (string-append
+                                  (getenv "GN_GUILE_PROFILE")
+                                  "/etc/ssl/certs/ca-certificates.crt"))
+         (setenv "GIT_SSL_CAINFO" (getenv "SSL_CERT_FILE"))
+         (setenv "CURL_CA_BUNDLE" (getenv "SSL_CERT_FILE"))
+         (setenv "REQUESTS_CA_BUNDLE" (getenv "SSL_CERT_FILE"))
+
+         (let ((current-repo-path (string-append (getcwd) "/gn-docs")))
+           (when (file-exists? current-repo-path)
+             (delete-file-recursively current-repo-path))
+           (setenv "CURRENT_REPO_PATH" current-repo-path)
+           (invoke #$(file-append git-minimal "/bin/git")
+                   "clone" "--depth" "1" (getenv "CGIT_REPO_PATH")))
+         (invoke "git" "clone" "--depth" "1" "https://git.genenetwork.org/gn-guile")
+
+         ;; We have a gn-guile-dev wrapper script that sets a "./" in the
+         ;; GN_GUILE_LOAD_PATH hence allowing this to be run from the gn-guile
+         ;; directory.  This allows gn-guile to be run from the latest
+         ;; upstream commits without pinning to guix.
+         (with-directory-excursion "gn-guile"
+           (show-head-commit)
+           (invoke #$(file-append gn-guile "/bin/gn-guile-dev")
+                   (number->string #$gn-guile-port)))))))
 
 (define (genenetwork-shepherd-services config)
   "Return shepherd services to run the genenetwork development server