about summary refs log tree commit diff
path: root/scripts/install-nix-from-closure.sh
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2016-11-09T18·09+0100
committerEelco Dolstra <edolstra@gmail.com>2016-11-09T18·09+0100
commit2af5d35fdc1171a9bdab7e2fc005673d76417c06 (patch)
tree0bc1ee4774971388874d5e37ff97c92c7ca139e2 /scripts/install-nix-from-closure.sh
parente4655b166c75a9e7d9629cc1a1463c4d580edc23 (diff)
parenteec5409a69054cf21214c3f5846ec0310fcb8228 (diff)
Merge branch 'master' of github.com:NixOS/nix
Diffstat (limited to 'scripts/install-nix-from-closure.sh')
-rw-r--r--scripts/install-nix-from-closure.sh30
1 files changed, 17 insertions, 13 deletions
diff --git a/scripts/install-nix-from-closure.sh b/scripts/install-nix-from-closure.sh
index 3b8c97ed26a1..fd38a4528cd7 100644
--- a/scripts/install-nix-from-closure.sh
+++ b/scripts/install-nix-from-closure.sh
@@ -89,21 +89,25 @@ if [ -z "$_NIX_INSTALLER_TEST" ]; then
     $nix/bin/nix-channel --update nixpkgs
 fi
 
-# Make the shell source nix.sh during login.
-p=$HOME/.nix-profile/etc/profile.d/nix.sh
-
 added=
-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 "if [ -e $p ]; then . $p; fi # added by Nix installer" >> $fn
+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 "if [ -e $p ]; then . $p; fi # added by Nix installer" >> $fn
+            fi
+            added=1
+            break
         fi
-        added=1
-        break
-    fi
-done
+    done
+
+fi
 
 if [ -z "$added" ]; then
     cat >&2 <<EOF