From 02ea337a36a955361d7d2a69e6da2caf1c0c496d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Wed, 25 Jan 2017 18:03:50 +0100 Subject: [PATCH] Install from closure: wording and fallback using .bash_profile - use empty ~/.bash_profile if it's not there - use "source" instead of vague "." - make it explicit how to start using Nix after installation --- scripts/install-nix-from-closure.sh | 44 +++++++++++++---------------- 1 file changed, 19 insertions(+), 25 deletions(-) diff --git a/scripts/install-nix-from-closure.sh b/scripts/install-nix-from-closure.sh index 1b4d92632..b928a1950 100644 --- a/scripts/install-nix-from-closure.sh +++ b/scripts/install-nix-from-closure.sh @@ -90,43 +90,37 @@ if [ -z "$_NIX_INSTALLER_TEST" ]; then fi added= + +# Make the shell source nix.sh during login. +p=$HOME/.nix-profile/etc/profile.d/nix.sh + if [ -z "$NIX_INSTALLER_NO_MODIFY_PROFILE" ]; then - - # Make the shell source nix.sh during login. - p=$HOME/.nix-profile/etc/profile.d/nix.sh - for i in .bash_profile .bash_login .profile; do fn="$HOME/$i" if [ -w "$fn" ]; then if ! grep -q "$p" "$fn"; then - echo "modifying $fn..." >&2 + echo "$0: modifying $fn..." >&2 echo "if [ -e $p ]; then . $p; fi # added by Nix installer" >> "$fn" fi added=1 break fi done - fi if [ -z "$added" ]; then - cat >&2 <&2 <&2 + touch ~/.bash_profile + chmod +x ~/.bash_profile + echo "if [ -e $p ]; then . $p; fi # added by Nix installer" >> /.bash_profile fi + +cat >&2 <