-
Notifications
You must be signed in to change notification settings - Fork 0
/
.envrc
47 lines (43 loc) · 1.17 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
# Usage: use_flox [...]
#
# Loads the environment variables from a Flox envrionment
# By default, uses the ".flox" directory to load the envrionment from
# You can also specify a remote envrionment as follows
#
# ```
# use_flox --remote=<owner>/<name>
# ```
# or
# ```
# use_flox --trust --remote=<owner>/<name>
# ```
#
# Where <owner>/<name> is the name of the remote environment on FloxHub
#
# You can also specify another directory to load the environment from
#
# ```
# use_flox --dir=<path>
# ```
#
# Where <path> is the path to a directory containing a ".flox" directory
#
# Custom commands aren't supported, since we use the `flox activate` command to dump and load the environment
#
function use_flox() {
if [[ ! -d ".flox" ]]; then
printf "direnv(use_flox): \`.flox\` directory not found\n" >&2
printf "direnv(use_flox): Did you run \`flox init\` in this directory?\n" >&2
return 1
fi
echo ""
echo "Loading \`flox-orb\` environment ..."
echo ""
direnv_load flox activate "$@" -- "$direnv" dump
if [[ $# == 0 ]]; then
watch_dir ".flox/env/"
watch_file ".flox/env.json"
watch_file ".flox/env.lock"
fi
}
use_flox