diff mbox series

[bug#55297,01/10] search-paths: Define $SSL_CERT_DIR and $SSL_CERT_FILE.

Message ID 20220507083740.59995-1-maximedevos@telenet.be
State Accepted
Headers show
Series Make adding SSL_CERT_FILE/DIR search paths easier and add some missing ones | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

M May 7, 2022, 8:37 a.m. UTC
For the ‘why’, see the docstring next to $SSL_CERT_DIR.  In later commits,
packages will be changed to use these variables and the variables will be
added to more packages.

* guix/search-paths.scm ($SSL_CERT_DIR, $SSL_CERT_FILE): New variables.
* doc/guix.texi (Search Paths): Document them.
---
 doc/guix.texi         | 21 ++++++++++++++++++++-
 guix/search-paths.scm | 26 ++++++++++++++++++++++++++
 2 files changed, 46 insertions(+), 1 deletion(-)


base-commit: 855097683230b756ba28636bed03ce904b6f3589
prerequisite-patch-id: 8c36bd91ff2f97cee25843119fdb12a71b3947bd
prerequisite-patch-id: 3082a0c917de3ca7abf1fc40c2fced691da6d99f
prerequisite-patch-id: ae89e00772cf3737e32b3b7bd191bfbeaaf5d0ed
prerequisite-patch-id: d74573180a62eaa0b6ac57ef46d08409fb5652a8
prerequisite-patch-id: ccb777079d8182a3e44b29cc061f59496ae16188
prerequisite-patch-id: cbb90155003134235f98b750f5e4de2096c9e414
prerequisite-patch-id: ff8b567c0b58018b9c2085a324ce02711eadc77e
prerequisite-patch-id: 6569c696b96227cfb2f056a894d441b99141a571
prerequisite-patch-id: eeb5c4446896b7d5209de79e7b9a2486a9a5dadb
prerequisite-patch-id: 226931bbd40f2e7b43df22ea44783293d663e97a
prerequisite-patch-id: 7b0f5bf490c804d1ce3f3bb0daf45273ce9bae8a
prerequisite-patch-id: 0605551576cb5fbb0215575f8acee2ad91441ec8
prerequisite-patch-id: 851c816dcdc728b085c2cad0f00b140113915af7
prerequisite-patch-id: eca886865831aca6a9803626f60fd37f1f3e1a49
prerequisite-patch-id: 49190c9aa45e582877c7716c59f4f509a4623948
prerequisite-patch-id: f9e4fa15bc34d249aecf318c66cb598762ee5728
prerequisite-patch-id: 69e49a32a11f33c23ccaa1a785c40dfc04068403
prerequisite-patch-id: ec55a066dbaf5790b993edfbead3d27c7817949e
prerequisite-patch-id: 44dedf2945b47ffe0a298b7129e7134567327d2d
prerequisite-patch-id: 441f8c8acc52886c30a2ca167329cf5117b9d024
prerequisite-patch-id: ad05c828905c092a370a7b267c09c4ec2dbc4850
prerequisite-patch-id: 4683b5d9fe136a4f71cf3f8f6fa99363b80aaa64
prerequisite-patch-id: bd6189df0a2a0122a769ba3f849dcd1f047dea14
prerequisite-patch-id: b723e932d080a91ab5d87a92c154e6ede074fe9c
prerequisite-patch-id: cb2dd382af23e9d1d7eb63f55c463ea15ab7fb95
diff mbox series

Patch

diff --git a/doc/guix.texi b/doc/guix.texi
index 7369a306f6..25e2429533 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -88,7 +88,7 @@  Copyright @copyright{} 2020 Daniel Brooks@*
 Copyright @copyright{} 2020 John Soo@*
 Copyright @copyright{} 2020 Jonathan Brielmaier@*
 Copyright @copyright{} 2020 Edgar Vincent@*
-Copyright @copyright{} 2021 Maxime Devos@*
+Copyright @copyright{} 2021, 2022 Maxime Devos@*
 Copyright @copyright{} 2021 B. Wilson@*
 Copyright @copyright{} 2021 Xinglu Chen@*
 Copyright @copyright{} 2021 Raghav Gururajan@*
@@ -9830,6 +9830,25 @@  Again, the libxml2 example shows a situation where this is needed.
 @end table
 @end deftp
 
+Some search paths are not tied by a single package but to many packages.
+To reduce duplications, some of them are pre-defined in @code{(guix
+search-paths)}.
+
+@defvr {Scheme Variable} $SSL_CERT_DIR
+@defvrx {Scheme Variable} $SSL_CERT_FILE
+These two search paths indicate where X.509 certificates can be found
+(@pxref{X.509 Certificates}).
+@end defvr
+
+These pre-defined search paths can be used as in the following example:
+
+@lisp
+(package
+  (name "curl")
+  ;; some fields omitted ...
+  (native-search-paths (list $SSL_CERT_DIR $SSL_CERT_FILE)))
+@end lisp
+
 How do you turn search path specifications on one hand and a bunch of
 directories on the other hand in a set of environment variable
 definitions?  That's the job of @code{evaluate-search-paths}.
diff --git a/guix/search-paths.scm b/guix/search-paths.scm
index 002e6342bb..6b13a98946 100644
--- a/guix/search-paths.scm
+++ b/guix/search-paths.scm
@@ -1,5 +1,6 @@ 
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2013, 2014, 2015, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2022 Maxime Devos <maximedevos@telenet.be>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -32,6 +33,8 @@  (define-module (guix search-paths)
             search-path-specification-file-pattern
 
             $PATH
+            $SSL_CERT_DIR
+            $SSL_CERT_FILE
 
             search-path-specification->sexp
             sexp->search-path-specification
@@ -70,6 +73,29 @@  (define $PATH
    (variable "PATH")
    (files '("bin" "sbin"))))
 
+;; Two variables for certificates (see (guix)X.509 Certificates),
+;; respected by 'openssl', possibly GnuTLS in the future
+;; (https://gitlab.com/gnutls/gnutls/-/merge_requests/1541)
+;; and many of their dependents -- even some GnuTLS depepdents
+;; like Guile.  As they are not tied to a single package, define
+;; them here to avoid duplication.
+;;
+;; Additionally, the 'native-search-paths' field is not thunked,
+;; so doing (package-native-search-paths openssl)
+;; could cause import cycle issues.
+(define-public $SSL_CERT_DIR
+  (search-path-specification
+   (variable "SSL_CERT_DIR")
+   (separator #f)              ;single entry
+   (files '("etc/ssl/certs"))))
+
+(define-public $SSL_CERT_FILE
+  (search-path-specification
+   (variable "SSL_CERT_FILE")
+   (file-type 'regular)
+   (separator #f)              ;single entry
+   (files '("etc/ssl/certs/ca-certificates.crt"))))
+
 (define (search-path-specification->sexp spec)
   "Return an sexp representing SPEC, a <search-path-specification>.  The sexp
 corresponds to the arguments expected by `set-path-environment-variable'."