]>
Git — Sourcephile - sourcephile-nix.git/blob - .lib/nix/envrc.sh
1 [ "$(id -u)" != 0 ] || {
2 log_status
"ERROR: running as root"
6 [ "$(nix --version)" = "nix (Nix) $(cat version)" ] || {
7 log_status
"installing Nix core tools"
10 . ~
/.nix
-profile/etc
/profile.d
/nix.sh
12 gcroots
="$OLDPWD"/.cache
/nix
/gcroots
13 log_status
"registering Nix dependencies into $(realpath -m --relative-to="$OLDPWD" $gcroots)/"
14 rm -rf $gcroots # NOTE: remove dependencies no longer set in shell.nix
16 nix
-instantiate >/dev
/null shell.nix \
17 --indirect --add-root $gcroots/shell.drv
18 nix
-store >/dev
/null
${OFFLINE:+--option substituters ""} \
19 --indirect --add-root $gcroots/shell.dep \
20 --realise $(nix-store --query --references $gcroots/shell.drv)
22 use nix shell.nix
--pure