Skip to content

Commit 6fc1959

Browse files
committed
Install Nix: add setupProfile()
rm old sourcing nix.sh rm old ! nix-env -i
1 parent 9787e74 commit 6fc1959

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

scripts/install-nix-from-closure.sh

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -697,17 +697,25 @@ installNix() {
697697
"
698698
fi
699699
}
700+
701+
setupProfile() {
702+
# Modifying current runtime environment variables to use Nix.
703+
# Persistent changes are configured later.
704+
print "Launching $nix/etc/profile.d/nix.sh"
705+
# shellcheck source=/dev/null
706+
. "$nix/etc/profile.d/nix.sh"
707+
print "Left $nix/etc/profile.d/nix.sh"
708+
if ! "$nix/bin/nix-env" -i "$nix"; then
709+
error "
710+
711+
Unable to install Nix into your default profile
712+
"
713+
fi
714+
}
700715
}
701716

702717
}
703718
echo "performing a single-user installation of Nix..." >&2
704-
. "$nix/etc/profile.d/nix.sh"
705-
706-
if ! "$nix/bin/nix-env" -i "$nix"; then
707-
echo "$0: unable to install Nix into your default profile" >&2
708-
exit 1
709-
fi
710-
711719
# Install an SSL certificate bundle.
712720
if [ -z "$NIX_SSL_CERT_FILE" ] || ! [ -f "$NIX_SSL_CERT_FILE" ]; then
713721
$nix/bin/nix-env -i "$cacert"

0 commit comments

Comments
 (0)