-
Notifications
You must be signed in to change notification settings - Fork 1
/
.envrc
52 lines (43 loc) · 1.21 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
48
49
50
51
52
COLOR_YELLOW="\033[1;33m"
FORMAT_BOLD="\033[1m"
FORMAT_NONE="\033[0m"
MSG_WARNING="${FORMAT_BOLD}${COLOR_YELLOW}WARNING${FORMAT_NONE}"
# venv
VENV="deps/venv"
if [ -d "$VENV" ]; then
if [ -n "$FISH_VERISON" ]; then
. "$VENV/bin/activate.fish"
else
. "$VENV/bin/activate"
fi
else
printf '%b: no virtual environment detected!\n' "$MSG_WARNING"
fi
# Cargo/Rust
PATH_add deps/rust/current
export CARGO_HOME="$PWD/deps/rust/current"
export RUSTUP_HOME="$PWD/deps/rust/current"
# Aliases -------------------------------------------------
# https://github.com/direnv/direnv/issues/73#issuecomment-1242969787
export_alias() {
local name=$1
shift
local alias_dir=$PWD/.direnv/aliases
local target="$alias_dir/$name"
local oldpath="$PATH"
mkdir -p "$alias_dir"
if ! [[ ":$PATH:" == *":$alias_dir:"* ]]; then
PATH_add "$alias_dir"
fi
echo "#!/usr/bin/env bash" > "$target"
echo "PATH=\"$oldpath\"" >> "$target"
echo "$@" >> "$target"
chmod +x "$target"
}
# Invoke pio through scons for best dependency management.
export_alias fwpio "scons -DQs fw \"--pioflags=\$*\""
ESPR_ENV="$PWD/deps/rust/current/esp-env.sh"
if [ ! -f $ESPR_ENV ]; then
scons deps-esp-rust
fi
. $ESPR_ENV