about summary refs log tree commit diff
path: root/scripts/nix-profile.sh.in
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2004-01-05T11·18+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2004-01-05T11·18+0000
commitf83c5e3e5f3e6b33c095d6559a4b3cd5922e88ce (patch)
treea54f68b0882367374c88d58a6812461c7b40be0c /scripts/nix-profile.sh.in
parent0e68af0ce380b09c14ff36084499c0d8a6590b25 (diff)
* Implemented Eelco V.'s `-p' command to switch profiles. It switches
  the symlink ~/.nix-userenv to the given argument (which defaults to
  .../links/current).  /etc/profile.d/nix-profile creates this symlink
  if it doesn't exist yet.  Example use:

  $ nix-env -l my_profile -i foo.nix subversion quake
  $ nix-env -p my_profile

  I don't like the term "profile".  Let's deprecate it :-)

Diffstat (limited to 'scripts/nix-profile.sh.in')
-rw-r--r--scripts/nix-profile.sh.in27
1 files changed, 9 insertions, 18 deletions
diff --git a/scripts/nix-profile.sh.in b/scripts/nix-profile.sh.in
index 0d059e1a25de..064a6a347a4a 100644
--- a/scripts/nix-profile.sh.in
+++ b/scripts/nix-profile.sh.in
@@ -1,20 +1,11 @@
-#if test -z "$NIX_SET"; then
+if test -n "$HOME"; then
+    NIX_LINK="$HOME/.nix-userenv"
 
-#    export NIX_SET=1
+    if ! test -a "$NIX_LINK"; then
+        echo "creating $NIX_LINK"
+        _NIX_DEF_LINK=@localstatedir@/nix/links/current
+        ln -s "$_NIX_DEF_LINK" "$NIX_LINK"
+    fi
 
-    NIX_LINKS=@localstatedir@/nix/links/current
-
-    export PATH=$NIX_LINKS/bin:@prefix@/bin:$PATH
-
-#    export LD_LIBRARY_PATH=$NIX_LINKS/lib:$LD_LIBRARY_PATH
-
-    export LIBRARY_PATH=$NIX_LINKS/lib:$LIBRARY_PATH
-
-    export C_INCLUDE_PATH=$NIX_LINKS/include:$C_INCLUDE_PATH
-    export CPLUS_INCLUDE_PATH=$NIX_LINKS/include:$CPLUS_INCLUDE_PATH
-
-    export PKG_CONFIG_PATH=$NIX_LINKS/lib/pkgconfig:$PKG_CONFIG_PATH
-
-#    export MANPATH=$NIX_LINKS/man:$MANPATH
-
-#fi
+    export PATH=$NIX_LINK/bin:@prefix@/bin:$PATH
+fi