# Direnv configuration for rustledger
# See: https://direnv.net/

# Use Nix flake development shell
use flake

# Watch for changes in flake files
watch_file flake.nix
watch_file flake.lock

# Project-local cargo target directory (optional - faster builds, more disk)
# export CARGO_TARGET_DIR="${PWD}/.cargo-target"

# Rust configuration
export RUST_BACKTRACE=1
export RUST_LOG=info

# Colored cargo output
export CARGO_TERM_COLOR=always

# Use mold linker if available (faster linking on Linux)
if command -v mold &>/dev/null && [[ "$(uname)" == "Linux" ]]; then
  export CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER="clang"
  export RUSTFLAGS="-C link-arg=-fuse-ld=mold"
fi
