-
Notifications
You must be signed in to change notification settings - Fork 1
/
.envrc
28 lines (24 loc) · 1.06 KB
/
.envrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
if ! has nix_direnv_version || ! nix_direnv_version 3.0.6; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.6/direnvrc" "sha256-RYcUJaRMf8oF5LznDrlCXbkOQrywm0HDv1VjYGaJGdM="
fi
IGREEN='\e[0;92m'
IRED='\e[0;91m'
NC='\e[0m'
if [ $(nix eval --impure --expr 'let f = builtins.getFlake "git+file://${toString ./.}"; in f.lib.versionAtLeast builtins.nixVersion "2.17.0"') != "true" ]; then
echo -e "The nix version must be at least ${IGREEN}2.17.0${NC} for fetchClosure of pure packages."
echo -e "Your version is ${IRED}$(nix --version)${NC}"
exit
fi
if [ $(nix eval --expr 'builtins ? fetchClosure') != "true" ]; then
echo -e "Experimental nix feature \"${IGREEN}fetch-closure${NC}\" ${IRED}must be enabled${NC} for fetchClosure of pure packages."
echo "You may need to add the following to your nix config:"
echo
echo "nix.settings.extraOptions = \"experimental-features = fetch-closure\";"
exit
fi
[ -f .envrc.local ] && source .envrc.local
if [ -n "${DEVSHELL_TARGET:-}" ]; then
use flake .#${DEVSHELL_TARGET}
else
use flake
fi