2008-07-16 18:01:09 +02:00
|
|
|
# This file is executed by all login shells. Don't ask what a login
|
|
|
|
# shell is, nobody knows. Most global environment variables should go
|
|
|
|
# in /etc/bashrc, which is by default included by non-login shells,
|
|
|
|
# but which we include here as well.
|
2007-01-15 15:43:56 +01:00
|
|
|
|
2008-07-16 18:01:09 +02:00
|
|
|
source /etc/bashrc
|
2007-11-15 18:16:16 +01:00
|
|
|
|
|
|
|
|
2007-01-15 15:43:56 +01:00
|
|
|
# Set up the per-user profile.
|
|
|
|
mkdir -m 0755 -p $NIX_USER_PROFILE_DIR
|
2007-01-16 14:30:59 +01:00
|
|
|
if test "$(stat --printf '%u' $NIX_USER_PROFILE_DIR)" != "$(id -u)"; then
|
|
|
|
echo "WARNING: bad ownership on $NIX_USER_PROFILE_DIR" >&2
|
2007-01-15 15:43:56 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
if ! test -L $HOME/.nix-profile; then
|
2007-03-20 14:50:47 +01:00
|
|
|
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
|
2007-01-15 15:43:56 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
2007-08-22 16:58:51 +02:00
|
|
|
# Create the per-user garbage collector roots directory.
|
|
|
|
NIX_USER_GCROOTS_DIR=/nix/var/nix/gcroots/per-user/$USER
|
|
|
|
mkdir -m 0755 -p $NIX_USER_GCROOTS_DIR
|
|
|
|
if test "$(stat --printf '%u' $NIX_USER_GCROOTS_DIR)" != "$(id -u)"; then
|
|
|
|
echo "WARNING: bad ownership on $NIX_USER_GCROOTS_DIR" >&2
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2007-01-15 15:43:56 +01:00
|
|
|
# Set up a default Nix expression from which to install stuff.
|
2007-09-18 17:06:24 +02:00
|
|
|
if test ! -e $HOME/.nix-defexpr -o -L $HOME/.nix-defexpr; then
|
2007-01-15 15:43:56 +01:00
|
|
|
echo "creating $HOME/.nix-defexpr" >&2
|
2007-09-18 17:06:24 +02:00
|
|
|
rm -f $HOME/.nix-defexpr
|
|
|
|
mkdir $HOME/.nix-defexpr
|
2008-01-30 02:28:56 +01:00
|
|
|
ln -s /etc/nixos/nixpkgs $HOME/.nix-defexpr/nixpkgs_sys
|
2007-09-18 17:06:24 +02:00
|
|
|
ln -s /etc/nixos/nixos $HOME/.nix-defexpr/nixos
|
|
|
|
if test "$USER" != root; then
|
|
|
|
ln -s /nix/var/nix/gcroots/per-user/root/channels $HOME/.nix-defexpr/channels_root
|
|
|
|
fi
|
2007-01-15 15:43:56 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Read system-wide modifications.
|
|
|
|
if test -f /etc/profile.local; then
|
|
|
|
source /etc/profile.local
|
|
|
|
fi
|