-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.envrc
More file actions
66 lines (58 loc) · 2.54 KB
/
.envrc
File metadata and controls
66 lines (58 loc) · 2.54 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# =============================================================================
# System Path Hardening (Homebrew / System Tools)
# =============================================================================
if [[ "$OSTYPE" == "darwin"* ]]; then
# Add Homebrew for Apple Silicon (M1/M2/M3)
if [[ -d "/opt/homebrew/bin" ]]; then
PATH_add "/opt/homebrew/bin"
PATH_add "/opt/homebrew/sbin"
fi
# Add Homebrew for Intel/Legacy
if [[ -d "/usr/local/bin" ]]; then
PATH_add "/usr/local/bin"
PATH_add "/usr/local/sbin"
fi
fi
# =============================================================================
# Python Virtual Environment
# =============================================================================
# Add requirements.txt to direnv's watch list to trigger reload on changes
watch_file crates/dev/scripts/requirements.txt
if [[ -f .venv/bin/activate ]]; then
source .venv/bin/activate
elif [[ -f crates/dev/scripts/venv/bin/activate ]]; then
source crates/dev/scripts/venv/bin/activate
else
# Only warn if in an interactive shell to avoid noise in CI/scripts
if [[ $- == *i* ]]; then
echo "💡 Tip: Virtual environment (.venv) not found."
echo " Run: python3 -m venv .venv && source .venv/bin/activate && pip install -r crates/dev/scripts/requirements.txt"
fi
fi
# =============================================================================
# Rust Build Optimization Environment
# =============================================================================
# Detect available CPU cores for parallel compilation (macOS/Linux)
if [[ "$OSTYPE" == "darwin"* ]]; then
export CARGO_BUILD_JOBS=$(sysctl -n hw.ncpu)
else
export CARGO_BUILD_JOBS=$(nproc 2>/dev/null || echo 4)
fi
# Enable cargo-nextest as the test runner if installed (much faster)
if command -v cargo-nextest &> /dev/null; then
export CARGO_TEST_COMMAND="nextest run"
fi
# RUSTFLAGS Optimization (supplemental to .cargo/config.toml)
# Note: target-cpu=native can make binaries non-portable; intended for local development.
# export RUSTFLAGS="${RUSTFLAGS:-} -C target-cpu=native"
# =============================================================================
# Development Tool Aliases
# =============================================================================
alias cb="cargo build"
alias cbf="cargo build --profile dev-fast"
alias cbr="cargo build --release"
alias cc="cargo check"
alias ct="cargo test"
alias ctf="cargo nextest run 2>/dev/null || cargo test"
alias cf="cargo fmt"
alias cl="cargo clippy"