Skip to content

Commit 2303d0d

Browse files
committed
Set CURL_CA_BUNDLE and SSL_CERT_FILE in all shell environments
curl does NOT check SSL_CERT_FILE — it only checks CURL_CA_BUNDLE and its built-in CA bundle path. The nixpkgs-built curl has /no-cert-file.crt as its built-in path (a sentinel when cacert is absent at build time). The cacert setup-hook (from PR #232) sets SSL_CERT_FILE but not CURL_CA_BUNDLE, so curl still fails in containers with: curl: (77) error adding trust anchors from file: /no-cert-file.crt Set both CURL_CA_BUNDLE (for curl) and SSL_CERT_FILE (for OpenSSL-based tools) directly in mkShell to ensure CA certificates are found regardless of whether the cacert setup-hook has run.
1 parent 4aaa200 commit 2303d0d

4 files changed

Lines changed: 24 additions & 0 deletions

File tree

cross-js.nix

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ let tool-version-map = (import ./tool-map.nix) self;
4848
quirks = (import ./quirks.nix { inherit pkgs; });
4949
in
5050
pkgs.mkShell ({
51+
# curl's built-in CA bundle path is /no-cert-file.crt (a sentinel from
52+
# nixpkgs when cacert is absent at build time). curl does NOT check
53+
# SSL_CERT_FILE — only CURL_CA_BUNDLE and its built-in path. Set both
54+
# so curl and OpenSSL-based tools find the CA bundle in containers.
55+
CURL_CA_BUNDLE = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt";
56+
SSL_CERT_FILE = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt";
5157
# Note [cabal override]:
5258
#
5359
# We need to override the `cabal` command and pass --ghc-options for the

cross-windows.nix

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,12 @@ let tool-version-map = (import ./tool-map.nix) self;
143143
quirks = (import ./quirks.nix { inherit pkgs; });
144144
in
145145
pkgs.pkgsBuildBuild.mkShell ({
146+
# curl's built-in CA bundle path is /no-cert-file.crt (a sentinel from
147+
# nixpkgs when cacert is absent at build time). curl does NOT check
148+
# SSL_CERT_FILE — only CURL_CA_BUNDLE and its built-in path. Set both
149+
# so curl and OpenSSL-based tools find the CA bundle in containers.
150+
CURL_CA_BUNDLE = "${pkgs.pkgsBuildBuild.cacert}/etc/ssl/certs/ca-bundle.crt";
151+
SSL_CERT_FILE = "${pkgs.pkgsBuildBuild.cacert}/etc/ssl/certs/ca-bundle.crt";
146152
# Note [cabal override]:
147153
#
148154
# We need to override the `cabal` command and pass --ghc-options for the

dynamic.nix

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ let tool-version-map = (import ./tool-map.nix) self;
6161
quirks = (import ./quirks.nix { inherit pkgs; });
6262
in
6363
pkgs.mkShell {
64+
# curl's built-in CA bundle path is /no-cert-file.crt (a sentinel from
65+
# nixpkgs when cacert is absent at build time). curl does NOT check
66+
# SSL_CERT_FILE — only CURL_CA_BUNDLE and its built-in path. Set both
67+
# so curl and OpenSSL-based tools find the CA bundle in containers.
68+
CURL_CA_BUNDLE = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt";
69+
SSL_CERT_FILE = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt";
6470
# The `cabal` overrride in this shell-hook doesn't do much yet. But
6571
# we may need to massage cabal a bit, so we'll leave it in here for
6672
# consistency with the one in static.nix.

static.nix

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ let tool-version-map = (import ./tool-map.nix) self;
6464
quirks = (import ./quirks.nix { inherit pkgs; static = true; });
6565
in
6666
pkgs.mkShell (rec {
67+
# curl's built-in CA bundle path is /no-cert-file.crt (a sentinel from
68+
# nixpkgs when cacert is absent at build time). curl does NOT check
69+
# SSL_CERT_FILE — only CURL_CA_BUNDLE and its built-in path. Set both
70+
# so curl and OpenSSL-based tools find the CA bundle in containers.
71+
CURL_CA_BUNDLE = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt";
72+
SSL_CERT_FILE = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt";
6773
# Note [cabal override]:
6874
#
6975
# We need to override the `cabal` command and pass --ghc-options for the

0 commit comments

Comments
 (0)