NBS_ONLY_LOAD_ENV_VARS=1 source env.sh

if command -v nix > /dev/null
then
  export NIMBUS_NIX_ENV=1

  cd nix
  # watch_file tells direnv that changes to any of the watched files
  # should trigger a re-evalution of the environment
  watch_file flake.nix
  watch_file flake.lock
  watch_file shell.nix

  mkdir -p .flake-profiles
  eval "$(nix print-dev-env --profile ".flake-profiles/profile")"
fi