diff mbox series

[bug#70674,core-updates,1/1] gnu: rust: Add CARGO_HTTP_CAINFO to native-search-path.

Message ID 2fc16ba2adb60b61fba0ebc7bd76ceac2da229e5.1714485108.git.jean-baptiste.note@m4x.org
State New
Headers show
Series Allow cargo to use custom SSL certificates | expand

Commit Message

Jean-Baptiste Note April 30, 2024, 2:17 p.m. UTC
* gnu/packages/rust.scm (rust-1.55): Add CARGO_HTTP_CAINFO native-search-path
so that Cargo honors custom certificates (a la GIT_SSL_CAINFO).
---
 gnu/packages/rust.scm | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm
index 60aa9b1ea0..aaba458933 100644
--- a/gnu/packages/rust.scm
+++ b/gnu/packages/rust.scm
@@ -539,9 +539,18 @@  (define-public rust-1.55
     (inputs
      `(("llvm" ,llvm-13)
        ("openssl" ,openssl)))
-    ;; rustc invokes gcc, so we need to set its search paths accordingly.
     (native-search-paths
-      %gcc-search-paths)
+     (cons
+      ;; For HTTPS access, Cargo reads from a single-file certificate
+      ;; specified with $CARGO_HTTP_CAINFO. See
+      ;; https://doc.rust-lang.org/cargo/reference/environment-variables.html
+      (search-path-specification
+       (variable "CARGO_HTTP_CAINFO")
+       (file-type 'regular)
+       (separator #f)              ;single entry
+       (files '("etc/ssl/certs/ca-certificates.crt")))
+      ;; rustc invokes gcc, so we need to set its search paths accordingly.
+      %gcc-search-paths))
     ;; Limit this to systems where the final rust compiler builds successfully.
     (supported-systems '("x86_64-linux" "aarch64-linux" "riscv64-linux"))
     (synopsis "Compiler for the Rust programming language")