-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.envrc
28 lines (24 loc) · 1.15 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.5; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.5/direnvrc" "sha256-RuwIS+QKFj/T9M2TFXScjBsLR6V3A17YVoEW/Q6AZ1w="
fi
IGREEN='\033[0;92m'
IRED='\033[0;91m'
NC='\033[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
if ! use flake . --impure
then
echo "devenv could not be built. The devenv environment was not loaded. Make the necessary changes to devenv.nix and hit enter to try again." >&2
fi
watch_file flake.nix
watch_file flake.lock