diff --git a/etc/profile.sh b/etc/profile.sh index b6ba962efe63..81ce4693bee4 100644 --- a/etc/profile.sh +++ b/etc/profile.sh @@ -53,6 +53,14 @@ done export PATH=$HOME/bin:$PATH +# 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 + + # Set up a default Nix expression from which to install stuff. if ! test -L $HOME/.nix-defexpr; then echo "creating $HOME/.nix-defexpr" >&2 diff --git a/system/activate-configuration.sh b/system/activate-configuration.sh index 917d0b44b0b8..5474dd905cba 100644 --- a/system/activate-configuration.sh +++ b/system/activate-configuration.sh @@ -117,6 +117,7 @@ fi # Nix initialisation. mkdir -m 0755 -p /nix/var/nix/db mkdir -m 0755 -p /nix/var/nix/gcroots +mkdir -m 1777 -p /nix/var/nix/gcroots/per-user mkdir -m 0755 -p /nix/var/nix/temproots mkdir -m 0755 -p /nix/var/nix/profiles mkdir -m 1777 -p /nix/var/nix/profiles/per-user