diff options
Diffstat (limited to 'scripts/install-nix-from-closure.sh')
-rw-r--r-- | scripts/install-nix-from-closure.sh | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/scripts/install-nix-from-closure.sh b/scripts/install-nix-from-closure.sh index 60ec1ea93219..c9ba9a2a280a 100644 --- a/scripts/install-nix-from-closure.sh +++ b/scripts/install-nix-from-closure.sh @@ -5,6 +5,7 @@ set -e dest="/nix" self="$(dirname "$0")" nix="@nix@" +cacert="@cacert@" if ! [ -e $self/.reginfo ]; then echo "$0: incomplete installer (.reginfo is missing)" >&2 @@ -66,26 +67,25 @@ fi . $nix/etc/profile.d/nix.sh -if ! $nix/bin/nix-env -i $nix; then +if ! $nix/bin/nix-env -i "$nix"; then echo "$0: unable to install Nix into your default profile" >&2 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 - if [ -n "$SSL_CERT_FILE" ]; then - $nix/bin/nix-channel --add https://nixos.org/channels/nixpkgs-unstable - else - $nix/bin/nix-channel --add http://nixos.org/channels/nixpkgs-unstable - fi + $nix/bin/nix-channel --add https://nixos.org/channels/nixpkgs-unstable fi if [ -z "$_NIX_INSTALLER_TEST" ]; then $nix/bin/nix-channel --update nixpkgs fi -# Install an SSL certificate bundle. -$nix/bin/nix-env -iA nixpkgs.cacert || true - # Make the shell source nix.sh during login. p=$NIX_LINK/etc/profile.d/nix.sh |