Skip to content

Commit cd94065

Browse files
committed
Install Nix: add installCerts()
rm old install certificates
1 parent 6fc1959 commit cd94065

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

scripts/install-nix-from-closure.sh

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -712,16 +712,28 @@ installNix() {
712712
"
713713
fi
714714
}
715+
716+
installCerts() {
717+
# Install an SSL certificate bundle.
718+
trap 'installCertsRevert $LINENO $?' INT TERM ABRT QUIT
719+
subscribeChannelsRevert() {
720+
errorRevert "Received Error signal from line $1"
721+
errorRevert "Reverting installation of certificate bundle"
722+
"$nix/bin/nix-env" --uninstall "$cacert"
723+
error "
724+
725+
Changes reverted.
726+
" "$2"
727+
}
728+
print 'Installing SSL certificate bundle.'
729+
"$nix/bin/nix-env" --install "$cacert"
730+
readonly NIX_SSL_CERT_FILE="$HOME/.nix-profile/etc/ssl/certs/ca-bundle.crt"
731+
export NIX_SSL_CERT_FILE
732+
}
715733
}
716734

717735
}
718736
echo "performing a single-user installation of Nix..." >&2
719-
# Install an SSL certificate bundle.
720-
if [ -z "$NIX_SSL_CERT_FILE" ] || ! [ -f "$NIX_SSL_CERT_FILE" ]; then
721-
$nix/bin/nix-env -i "$cacert"
722-
export NIX_SSL_CERT_FILE="$HOME/.nix-profile/etc/ssl/certs/ca-bundle.crt"
723-
fi
724-
725737
# Subscribe the user to the Nixpkgs channel and fetch it.
726738
if ! $nix/bin/nix-channel --list | grep -q "^nixpkgs "; then
727739
$nix/bin/nix-channel --add https://nixos.org/channels/nixpkgs-unstable

0 commit comments

Comments
 (0)