Commit e8d5078
authored
nix: carry over (NIX_)SSL_CERT_FILE to devbox shells (#178)
When `NIX_SSL_CERT_FILE` and `SSL_CERT_FILE` aren't explicitly set,
`nix-shell --pure` sets them to invalid paths
(specifically "/no-cert-file.crt") to ensure that openssl doesn't use
certificates that live outside of the current Nix environment. This
causes HTTPS requests in most programs to fail. For example:
(devbox) $ curl https://google.com
curl: (77) error setting certificate verify locations: CAfile:
/no-cert-file.crt CApath: none
This is pretty inconvenient for development, so we want to undo those
changes when launching a devbox shell. To do that, we:
1. Keep any `NIX_SSL_CERT_FILE` and `SSL_CERT_FILE` values that are set
in the parent shell.
2. Unset `NIX_SSL_CERT_FILE` or `SSL_CERT_FILE` when they're set to the
"/no-cert-file.crt" value set by `nix-shell`. This causes openssl to go
back to using the default paths.
NIX_SSL_CERT_FILE is used by some programs installed by Nix.
SSL_CERT_FILE is used by non-Nix programs and some Nix programs.
Fixes #177.1 parent 8a8905c commit e8d5078
2 files changed
+11
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
312 | 312 | | |
313 | 313 | | |
314 | 314 | | |
| 315 | + | |
| 316 | + | |
315 | 317 | | |
316 | 318 | | |
317 | 319 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
30 | 39 | | |
31 | 40 | | |
32 | 41 | | |
| |||
0 commit comments