mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 05:56:15 +02:00
install script: don't abort when "nix-channel --update" fails
Instead, print a message about what happened and tell the user what can be done (run "[sudo -i] nix-channel --update nixpkgs" again at a later time). This change allows installing Nix when you're offline. Since the multi-user installer is so verbose, the message isn't printed until the end. Fixes issue #2650 ("installation without internet connection").
This commit is contained in:
parent
e58a71442a
commit
b9567aa8b6
2 changed files with 13 additions and 2 deletions
|
@ -240,10 +240,16 @@ EOF
|
||||||
}
|
}
|
||||||
trap finish_fail EXIT
|
trap finish_fail EXIT
|
||||||
|
|
||||||
|
channel_update_failed=0
|
||||||
function finish_success {
|
function finish_success {
|
||||||
finish_cleanup
|
finish_cleanup
|
||||||
|
|
||||||
ok "Alright! We're done!"
|
ok "Alright! We're done!"
|
||||||
|
if [ "x$channel_update_failed" = x1 ]; then
|
||||||
|
echo ""
|
||||||
|
echo "But fetching the nixpkgs channel failed. (Are you offline?)"
|
||||||
|
echo "To try again later, run \"sudo -i nix-channel --update nixpkgs\"."
|
||||||
|
fi
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
|
|
||||||
Before Nix will work in your existing shells, you'll need to close
|
Before Nix will work in your existing shells, you'll need to close
|
||||||
|
@ -737,7 +743,9 @@ setup_default_profile() {
|
||||||
# otherwise it will be lost in environments where sudo doesn't pass
|
# otherwise it will be lost in environments where sudo doesn't pass
|
||||||
# all the environment variables by default.
|
# all the environment variables by default.
|
||||||
_sudo "to update the default channel in the default profile" \
|
_sudo "to update the default channel in the default profile" \
|
||||||
HOME="$ROOT_HOME" NIX_SSL_CERT_FILE="$NIX_SSL_CERT_FILE" "$NIX_INSTALLED_NIX/bin/nix-channel" --update nixpkgs
|
HOME="$ROOT_HOME" NIX_SSL_CERT_FILE="$NIX_SSL_CERT_FILE" "$NIX_INSTALLED_NIX/bin/nix-channel" --update nixpkgs \
|
||||||
|
|| channel_update_failed=1
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -138,7 +138,10 @@ if ! $nix/bin/nix-channel --list | grep -q "^nixpkgs "; then
|
||||||
$nix/bin/nix-channel --add https://nixos.org/channels/nixpkgs-unstable
|
$nix/bin/nix-channel --add https://nixos.org/channels/nixpkgs-unstable
|
||||||
fi
|
fi
|
||||||
if [ -z "$_NIX_INSTALLER_TEST" ]; then
|
if [ -z "$_NIX_INSTALLER_TEST" ]; then
|
||||||
$nix/bin/nix-channel --update nixpkgs
|
if ! $nix/bin/nix-channel --update nixpkgs; then
|
||||||
|
echo "Fetching the nixpkgs channel failed. (Are you offline?)"
|
||||||
|
echo "To try again later, run \"nix-channel --update nixpkgs\"."
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
added=
|
added=
|
||||||
|
|
Loading…
Reference in a new issue