Subject: [bug#55297] [PATCH 10/10] gnu: w3m: Add $SSL_CERT_DIR/$SSL_CERT_FILE search paths..

From: Maxime Devos <[email-masked]>
Date: Sat, 7 May 2022 08:37:40 +0000

Try

$ guix shell openssl w3m le-certs --pure -- w3m https://en.wikipedia.org

and

$ guix shell openssl w3m nss-certs --pure -- w3m https://en.wikipedia.org

The second command succeeds whereas the first command results in
‘unable to get local issuer certificate; accept? (y/n)’, so it looks
like w3m respects $SSL_CERT_DIR/$SSL_CERT_FILE.

* gnu/packages/w3m.scm (w3m)[native-search-paths]: Add
$SSL_CERT_DIR/$SSL_CERT_FILE search paths.
* gnu/ackages/freedesktop.scm (xdg-utils)[native-inputs]{w3m}: Use a variant
of 'w3m' without $SSL_CERT_DIR/$SSL_CERT_FILE to avoid rebuilds.
---
 gnu/packages/freedesktop.scm | 7 ++++++-
 gnu/packages/w3m.scm         | 2 ++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/freedesktop.scm b/gnu/packages/freedesktop.scm
index 55bde8e705..f785e42b89 100644
--- a/gnu/packages/freedesktop.scm
+++ b/gnu/packages/freedesktop.scm
@@ -409,7 +409,12 @@ (define-public xdg-utils
              "1nai806smz3zcb2l5iny4x7li0fak0rzmjg6vlyhdqm8z25b166p"))))
     (build-system gnu-build-system)
     (native-inputs
-     (list docbook-xsl docbook-xml-4.1.2 libxslt w3m xmlto))
+     (list docbook-xsl docbook-xml-4.1.2 libxslt
+           ;; TODO(staging): don't remove search paths.
+           ;; Search paths are temporarily removed to
+           ;; avoid rebuilds.
+           (package (inherit w3m) (native-search-paths '()))
+           xmlto))
     (inputs
      `(("awk" ,gawk)
        ("coreutils" ,coreutils)
diff --git a/gnu/packages/w3m.scm b/gnu/packages/w3m.scm
index 5239cd43a0..72ed22bfe4 100644
--- a/gnu/packages/w3m.scm
+++ b/gnu/packages/w3m.scm
@@ -35,6 +35,7 @@ (define-module (gnu packages w3m)
   #:use-module (gnu packages tls)
   #:use-module (gnu packages xorg)
   #:use-module (gnu packages)
+  #:use-module ((guix search-paths) #:select ($SSL_CERT_DIR $SSL_CERT_FILE))
   #:use-module (guix packages)
   #:use-module (guix git-download)
   #:use-module (guix build-system gnu))
@@ -78,6 +79,7 @@ (define-public w3m
        ("perl" ,perl)
        ("pkg-config" ,pkg-config)))
     (home-page "http://w3m.sourceforge.net/")
+    (native-search-paths (list $SSL_CERT_DIR $SSL_CERT_FILE))
     (synopsis "Text-mode web browser")
     (description
      "w3m is a text-based web browser as well as a pager like @code{more} or
-- 
2.35.1