Skip to content

Commit 79bd4ad

Browse files
committed
stdenv, cacert: consider $NIX_SSL_CERT_FILE in hooks
Some SSL libs don't react to $SSL_CERT_FILE. That actually makes sense to me, as we add this behavior as nixpkgs-specific, so it seems "safer" to use $NIX_*.
1 parent 9d3d5e9 commit 79bd4ad

3 files changed

Lines changed: 8 additions & 3 deletions

File tree

pkgs/data/misc/cacert/setup-hook.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
cacertHook() {
2+
export NIX_SSL_CERT_FILE=@out@/etc/ssl/certs/ca-bundle.crt
3+
# left for compatibility
24
export SSL_CERT_FILE=@out@/etc/ssl/certs/ca-bundle.crt
35
}
46

pkgs/development/interpreters/gauche/default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
2323
"--with-iconv=${libiconv}"
2424
"--with-dbm=gdbm"
2525
"--with-zlib=${zlib}"
26-
"--with-ca-bundle=$SSL_CERT_FILE"
26+
"--with-ca-bundle=$NIX_SSL_CERT_FILE"
2727
# TODO: Enable slib
2828
# Current slib in nixpkgs is specialized to Guile
2929
# "--with-slib=${slibGuile}/lib/slib"

pkgs/stdenv/generic/setup.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -646,9 +646,12 @@ fi
646646
export NIX_BUILD_CORES
647647

648648

649-
# Prevent OpenSSL-based applications from using certificates in
650-
# /etc/ssl.
649+
# Prevent SSL libraries from using certificates in /etc/ssl, unless set explicitly.
651650
# Leave it in shells for convenience.
651+
if [ -z "${NIX_SSL_CERT_FILE:-}" ] && [ -z "${IN_NIX_SHELL:-}" ]; then
652+
export NIX_SSL_CERT_FILE=/no-cert-file.crt
653+
fi
654+
# Another variant left for compatibility.
652655
if [ -z "${SSL_CERT_FILE:-}" ] && [ -z "${IN_NIX_SHELL:-}" ]; then
653656
export SSL_CERT_FILE=/no-cert-file.crt
654657
fi

0 commit comments

Comments
 (0)