about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-07-29T15·11+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-07-29T15·11+0200
commit50ed345fad74ec48d88393fc53e879de162d0192 (patch)
tree998900980bf8fb2284c17a4015af4ee94131143c
parent13a63b59bb821b3ac6600879acc19ff945e0099f (diff)
nix-profile.sh: Set $SSL_CERT_FILE
-rw-r--r--scripts/nix-profile.sh.in11
1 files changed, 10 insertions, 1 deletions
diff --git a/scripts/nix-profile.sh.in b/scripts/nix-profile.sh.in
index 5d682fc51a59..7dd7968c314a 100644
--- a/scripts/nix-profile.sh.in
+++ b/scripts/nix-profile.sh.in
@@ -1,4 +1,4 @@
-if test -n "$HOME"; then
+if [ -n "$HOME" ]; then
     NIX_LINK="$HOME/.nix-profile"
 
     # Set the default profile.
@@ -19,4 +19,13 @@ if test -n "$HOME"; then
     # <nixpkgs> paths work when the user has fetched the Nixpkgs
     # channel.
     export NIX_PATH=${NIX_PATH:+$NIX_PATH:}nixpkgs=$HOME/.nix-defexpr/channels/nixpkgs
+
+    # Set $SSL_CERT_FILE so that Nixpkgs applications like curl work.
+    if [ -e /etc/ssl/certs/ca-bundle.crt ]; then # Fedora, NixOS
+        export SSL_CERT_FILE=/etc/ssl/certs/ca-bundle.crt
+    elif [ -e /etc/ssl/certs/ca-certificates.crt ]; then # Ubuntu, Debian
+        export SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt
+    elif [ -e "$NIX_LINK/etc/ca-bundle.crt" ]; then # fall back to Nix profile
+        export SSL_CERT_FILE="$NIX_LINK/etc/ca-bundle.crt"
+    fi
 fi