-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy path.envrc
More file actions
30 lines (25 loc) · 1.17 KB
/
.envrc
File metadata and controls
30 lines (25 loc) · 1.17 KB
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
29
30
if command -v nix >/dev/null 2>&1; then
nix_min_version="2.23"
nix_version=$(nix --version 2>/dev/null | awk '{print $NF}')
if [ "$(printf '%s\n' "$nix_min_version" "$nix_version" | sort -V | head -n1)" != "$nix_min_version" ]; then
printf "\033[31mNix version %s is installed, but version %s or higher is required. Upgrade Nix using the package manager that you used to install it.\033[0m\n" "$nix_version" "$nix_min_version" >&2
exit 1
fi
else
printf "\nNix is not installed. Use the Determinate Nix Installer to install: https://github.com/DeterminateSystems/nix-installer" >&2
fi
# Check to ensure an up-to-date version of direnv is installed
if ! direnv_version 2.32.0; then
exit 1
fi
if ! has nix_direnv_version || ! nix_direnv_version 3.0.4; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.4/direnvrc" "sha256-DzlYZ33mWF/Gs8DDeyjr8mnVmQGx7ASYqA5WlxwvBG4="
fi
watch_file flake.nix
watch_file flake.lock
watch_file devenv.nix
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
dotenv_if_exists .env