forked from input-output-hk/sanchonet-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.envrc
32 lines (27 loc) · 1.18 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
29
30
31
32
if ! has nix_direnv_version || ! nix_direnv_version 2.3.0; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.3.0/direnvrc" "sha256-Dmd+j63L84wuzgyjITIfSxSD57Tx7v51DMxVZOsiUD8="
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
[ -s .envrc.local ] && source .envrc.local
if [ -z "${SOPS_AGE_KEY_FILE:-}" ] && [ -s ~/.age/credentials ]; then
export SOPS_AGE_KEY_FILE=~/.age/credentials
fi
if [ -n "${DEVSHELL_TARGET:-}" ]; then
use flake .#${DEVSHELL_TARGET}
else
use flake
fi