Skip to content

Set CURL_CA_BUNDLE for curl CA certificate discovery in containers#233

Merged
angerman merged 1 commit into
mainfrom
fix/cacert-for-curl
Feb 25, 2026
Merged

Set CURL_CA_BUNDLE for curl CA certificate discovery in containers#233
angerman merged 1 commit into
mainfrom
fix/cacert-for-curl

Conversation

@angerman
Copy link
Copy Markdown
Collaborator

Summary

  • Set CURL_CA_BUNDLE and SSL_CERT_FILE env vars in all 4 shell environments (dynamic.nix, static.nix, cross-js.nix, cross-windows.nix)
  • Fixes curl failing with error adding trust anchors from file: /no-cert-file.crt in -env containers
  • PR Add CA certificates for curl HTTPS in containers #232 added cacert to runtimeInputs but its setup-hook only sets SSL_CERT_FILE/NIX_SSL_CERT_FILE — curl does NOT check those, only CURL_CA_BUNDLE and its built-in path

Context

The nixpkgs-built curl has /no-cert-file.crt as its compiled-in CA bundle path (a sentinel value when cacert is absent at build time). In containers, there is no system CA store at that path, and curl's code path only checks CURL_CA_BUNDLE env var → built-in path. Setting CURL_CA_BUNDLE directly in mkShell ensures curl finds the CA bundle.

Test plan

  • Hydra eval + builds pass
  • Container uploads succeed
  • cabal update works in -env containers (validates HTTPS with curl)

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.
@angerman angerman added this pull request to the merge queue Feb 25, 2026
Merged via the queue into main with commit 3fe5796 Feb 25, 2026
654 of 867 checks passed
@angerman angerman deleted the fix/cacert-for-curl branch February 25, 2026 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant