# ── direnv + nix-direnv ─────────────────────────────
# Automatically enters the nix develop environment on cd.
# Requires: nix-direnv (https://github.com/nix-community/nix-direnv)
#
# Install:
#   1. Add nix-direnv to your home-manager or nixpkgs config
#   2. Add "use flake" to your ~/.direnvrc (or let nix-direnv handle it)
#   3. Run: direnv allow
#
# The bootstrap devShell provides python + uv without uv2nix.
# Once uv.lock exists, switch to "use flake" or keep using use flake
# which will pick up the default devShell automatically.

if ! has nix_direnv_version 2>/dev/null; then
  # Fallback for plain direnv without nix-direnv
  use flake
else
  # nix-direnv — faster, cached
  nix_direnv_watch_file flake.nix
  nix_direnv_watch_file flake.lock
  nix_direnv_watch_file pyproject.toml
  nix_direnv_watch_file uv.lock
  use flake
fi
