-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.envrc
47 lines (35 loc) · 1.43 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
######## JAMBHALAIKEN ENVIRONMENT CONFIGURATION ########
# Do not modify the contents of this file!
# To modify your configuration, change values of variables in the .env file.
# The .env file is created automatically for you when you load the environment the first time.
# Type ENTER/RETURN in your terminal session after modifying .env to apply your changes.
#### GENERAL SETUP ####
export PROJECT_ROOT=$(git rev-parse --show-toplevel)
# Add utility scripts to PATH
PATH_add ./scripts/
# Fix project if cloned without --recurse-submodules flag
fix-submodules.sh
# Add setup scripts to PATH
PATH_add ./jsetup-utils
# Make .env file from template if absent
mk-env.sh
# Source and watch the .env file:
dotenv
watch_file .env
#### LOAD NIX ENVIRONMENT ####
# Use nix-direnv for caching/persistence:
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
# Allow unfree packages (for closed-source VS Code extensions):
export NIXPKGS_ALLOW_UNFREE=1
if use flake . --impure --accept-flake-config --no-warn-dirty; then
export JAMB_ENV_LOADED=true
# Source cardano-cli-guru environment if not already loaded (makes Guru commands available from project root)
if [[ $GURU_ENV_LOADED != true ]]; then
source_env "$PROJECT_ROOT/cardano-cli-guru"
fi
else
echo "Error loading flake.nix"
exit 1
fi