1 diff --git a/src/crypto/x509/root_cgo_darwin.go b/src/crypto/x509/root_cgo_darwin.go
2 index 255a8d3525..a467255a54 100644
3 --- a/src/crypto/x509/root_cgo_darwin.go
4 +++ b/src/crypto/x509/root_cgo_darwin.go
5 @@ -280,6 +280,8 @@ int CopyPEMRoots(CFDataRef *pemRoots, CFDataRef *untrustedPemRoots, bool debugDa
14 @@ -295,6 +297,13 @@ func loadSystemRoots() (*CertPool, error) {
15 buf := C.GoBytes(unsafe.Pointer(C.CFDataGetBytePtr(data)), C.int(C.CFDataGetLength(data)))
16 roots := NewCertPool()
17 roots.AppendCertsFromPEM(buf)
18 + if file := os.Getenv("NIX_SSL_CERT_FILE"); file != "" {
19 + data, err := ioutil.ReadFile(file)
21 + roots.AppendCertsFromPEM(data)
26 if C.CFDataGetLength(untrustedData) == 0 {
28 diff --git a/src/crypto/x509/root_darwin.go b/src/crypto/x509/root_darwin.go
29 index 2f6a8b8d60..b81889fe69 100644
30 --- a/src/crypto/x509/root_darwin.go
31 +++ b/src/crypto/x509/root_darwin.go
32 @@ -92,6 +92,14 @@ func execSecurityRoots() (*CertPool, error) {
33 verifyCh = make(chan rootCandidate)
36 + if file := os.Getenv("NIX_SSL_CERT_FILE"); file != "" {
37 + data, err := ioutil.ReadFile(file)
39 + roots.AppendCertsFromPEM(data)
44 // Using 4 goroutines to pipe into verify-cert seems to be
45 // about the best we can do. The verify-cert binary seems to
46 // just RPC to another server with coarse locking anyway, so
47 diff --git a/src/crypto/x509/root_unix.go b/src/crypto/x509/root_unix.go
48 index 48de50b4ea..750e12c6b4 100644
49 --- a/src/crypto/x509/root_unix.go
50 +++ b/src/crypto/x509/root_unix.go
51 @@ -38,6 +38,13 @@ func (c *Certificate) systemVerify(opts *VerifyOptions) (chains [][]*Certificate
53 func loadSystemRoots() (*CertPool, error) {
54 roots := NewCertPool()
55 + if file := os.Getenv("NIX_SSL_CERT_FILE"); file != "" {
56 + data, err := ioutil.ReadFile(file)
58 + roots.AppendCertsFromPEM(data)
64 if f := os.Getenv(certFileEnv); f != "" {