]> Git — Sourcephile - sourcephile-nix.git/blob - .lib/nix/envrc.sh
gnupg: modify the root@commonsoft.org key
[sourcephile-nix.git] / .lib / nix / envrc.sh
1 [ "$(id -u)" != 0 ] || {
2 log_status "ERROR: running as root"
3 exit 1
4 }
5
6 [ "$(nix --version)" = "nix (Nix) $(cat version)" ] || {
7 log_status "installing Nix core tools"
8 sh ./install
9 }
10 . ~/.nix-profile/etc/profile.d/nix.sh
11
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
15 mkdir -p $gcroots
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)
21
22 use nix shell.nix --pure
23 watch_file shell.nix