about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-12-13T15·53+0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-12-13T15·53+0100
commitc2a552b0759b5b09223dbff41f968283cdcb7ed3 (patch)
tree2bb32417189d2cca833dc6679451a77be887165b
parentb77037b8fdd89cc06d80c3564e4a4f4a4fe8aa1d (diff)
Install cacert before running nix-channel
Also, make it more robust against incorrent SSL_CERT_FILE values.
-rw-r--r--scripts/install-nix-from-closure.sh11
1 files changed, 6 insertions, 5 deletions
diff --git a/scripts/install-nix-from-closure.sh b/scripts/install-nix-from-closure.sh
index 9977dca2cab9..c9ba9a2a280a 100644
--- a/scripts/install-nix-from-closure.sh
+++ b/scripts/install-nix-from-closure.sh
@@ -72,6 +72,12 @@ if ! $nix/bin/nix-env -i "$nix"; then
     exit 1
 fi
 
+# Install an SSL certificate bundle.
+if [ -z "$SSL_CERT_FILE" -o ! -f "$SSL_CERT_FILE" ]; then
+    $nix/bin/nix-env -i "$cacert"
+    export SSL_CERT_FILE="$HOME/.nix-profile/etc/ca-bundle.crt"
+fi
+
 # Subscribe the user to the Nixpkgs channel and fetch it.
 if ! $nix/bin/nix-channel --list | grep -q "^nixpkgs "; then
     $nix/bin/nix-channel --add https://nixos.org/channels/nixpkgs-unstable
@@ -80,11 +86,6 @@ if [ -z "$_NIX_INSTALLER_TEST" ]; then
     $nix/bin/nix-channel --update nixpkgs
 fi
 
-# Install an SSL certificate bundle.
-if [ -z "$SSL_CERT_FILE" ]; then
-    $nix/bin/nix-env -i "$cacert"
-fi
-
 # Make the shell source nix.sh during login.
 p=$NIX_LINK/etc/profile.d/nix.sh