From 128660d8e2853c4099945e0dbdb54cbbe56bbd0d Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 20 Mar 2007 13:50:47 +0000 Subject: [PATCH] * Root installs in the system-wide profile (/nix/var/nix/profiles/default) by default. * In /etc/profile, put /var/run/current-system/sw/[s]bin in $PATH, not the targets of those symlink. Otherwise users need to log out to make configuration changes to the systemPath take effect. svn path=/nixos/trunk/; revision=8384 --- system/etc/profile.sh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/system/etc/profile.sh b/system/etc/profile.sh index 16a5efd7f7b3..7ec0a535d21b 100644 --- a/system/etc/profile.sh +++ b/system/etc/profile.sh @@ -1,16 +1,21 @@ -export PATH=@wrapperDir@:@systemPath@/bin:@systemPath@/sbin +export PATH=@wrapperDir@:/var/run/current-system/sw/bin:/var/run/current-system/sw/sbin export MODULE_DIR=@kernel@/lib/modules export NIX_CONF_DIR=/nix/etc/nix export PAGER=less export TZ=@timeZone@ export FONTCONFIG_FILE=/etc/fonts/fonts.conf + +# A nice prompt. PROMPT_COLOR="1;31m" PS1="\n\[\033[$PROMPT_COLOR\][\u@\h:\w]$\[\033[0m\] " if test "x$TERM" == "xxterm"; then PS1="\033]2;\h:\u:\w\007$PS1" fi + +# Set up secure multi-user builds: non-root users build through the +# Nix daemon. if test "$USER" != root; then export NIX_REMOTE=daemon else @@ -26,8 +31,13 @@ if test "$(stat --printf '%u' $NIX_USER_PROFILE_DIR)" != "$(id -u)"; then fi if ! test -L $HOME/.nix-profile; then - echo "creating $HOME/.nix-profile" >&2 - ln -s $NIX_USER_PROFILE_DIR/profile $HOME/.nix-profile + echo "creating $HOME/.nix-profile" >&2 + if test "$USER" != root; then + ln -s $NIX_USER_PROFILE_DIR/profile $HOME/.nix-profile + else + # Root installs in the system-wide profile by default. + ln -s /nix/var/nix/profiles/default $HOME/.nix-profile + fi fi NIX_PROFILES="/nix/var/nix/profiles/default $NIX_USER_PROFILE_DIR/profile"