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 @@ -816,29 +816,34 @@ installNix() {
816816{
817817
818818postinstall () {
819- }
820819
821- }
822- added=
823- if [ -z " $NIX_INSTALLER_NO_MODIFY_PROFILE " ]; then
824-
825- # Make the shell source nix.sh during login.
826- p=$HOME /.nix-profile/etc/profile.d/nix.sh
827-
828- for i in .bash_profile .bash_login .profile; do
829- fn=" $HOME /$i "
830- if [ -w " $fn " ]; then
831- if ! grep -q " $p " " $fn " ; then
832- echo " modifying $fn ..." >&2
833- echo " if [ -e $p ]; then . $p ; fi # added by Nix installer" >> " $fn "
834- fi
835- added=1
836- break
837- fi
838- done
820+ notice '
839821
840- fi
822+ Launching postinstall tasks:
823+ '
824+ added=0
825+ if [ -z " $NIX_INSTALLER_NO_MODIFY_PROFILE " ]; then
826+ # Make shell to source nix.sh during login.
827+ readonly nix_profile=" $HOME /.nix-profile/etc/profile.d/nix.sh"
828+ for file in .bash_profile .bash_login .profile; do
829+ user_profile=" $HOME /$file "
830+ if [ -w " $user_profile " ]; then
831+ if ! grep -q " $nix_profile " " $user_profile " ; then
832+ notice "
833+
834+ Modifying $user_profile ...
835+ "
836+ printf ' if [ -e %s ]; then . %s; fi # added by Nix installer\n' \
837+ " $nix_profile " " $nix_profile " >> " $user_profile "
838+ fi
839+ added=1
840+ break
841+ fi
842+ done
843+ fi
844+ }
841845
846+ }
842847if [ -z " $added " ]; then
843848 cat >&2 << EOF
844849
You can’t perform that action at this time.
0 commit comments