File tree Expand file tree Collapse file tree 1 file changed +25
-20
lines changed Expand file tree Collapse file tree 1 file changed +25
-20
lines changed Original file line number Diff line number Diff line change @@ -817,29 +817,34 @@ installNix() {
817817{
818818
819819postinstall () {
820- }
821820
822- }
823- added=
824- if [ -z " $NIX_INSTALLER_NO_MODIFY_PROFILE " ]; then
825-
826- # Make the shell source nix.sh during login.
827- p=$HOME /.nix-profile/etc/profile.d/nix.sh
828-
829- for i in .bash_profile .bash_login .profile; do
830- fn=" $HOME /$i "
831- if [ -w " $fn " ]; then
832- if ! grep -q " $p " " $fn " ; then
833- echo " modifying $fn ..." >&2
834- echo " if [ -e $p ]; then . $p ; fi # added by Nix installer" >> " $fn "
835- fi
836- added=1
837- break
838- fi
839- done
821+ notice '
840822
841- fi
823+ Launching postinstall tasks:
824+ '
825+ added=0
826+ if [ -z " $NIX_INSTALLER_NO_MODIFY_PROFILE " ]; then
827+ # Make shell to source nix.sh during login.
828+ readonly nix_profile=" $HOME /.nix-profile/etc/profile.d/nix.sh"
829+ for file in .bash_profile .bash_login .profile; do
830+ user_profile=" $HOME /$file "
831+ if [ -w " $user_profile " ]; then
832+ if ! grep -q " $nix_profile " " $user_profile " ; then
833+ notice "
834+
835+ Modifying $user_profile ...
836+ "
837+ printf ' if [ -e %s ]; then . %s; fi # added by Nix installer\n' \
838+ " $nix_profile " " $nix_profile " >> " $user_profile "
839+ fi
840+ added=1
841+ break
842+ fi
843+ done
844+ fi
845+ }
842846
847+ }
843848if [ -z " $added " ]; then
844849 cat >&2 << EOF
845850
You can’t perform that action at this time.
0 commit comments