nu-config 0.115.0

Nushell configuration infrastructure - path resolution and config file management
Documentation

Nushell configuration infrastructure.

This crate owns all XDG-aware path resolution for Nushell configuration files and directories. It is the single source of truth for where config lives. It does not evaluate or parse config files — that is the job of nu-cli / the nu binary.

Architecture

CLI flags + process env + platform dirs
             │
             ▼
     resolve_paths()          ← one-shot at startup
             │
             ▼
    NushellConfigDirs         ← stored on EngineState.config_dirs
             │
    ┌────────┼────────┬──────────────┐
    ▼        ▼        ▼              ▼
 $nu.*   loaders   history       plugins

After startup, do not re-read XDG_* env vars or call free path helpers. Always read from [NushellConfigDirs].

Resolution priority

For every path:

  1. CLI override ([CliOverrides] — e.g. --config-home, --config)
  2. XDG environment variable (e.g. $XDG_CONFIG_HOME)
  3. Platform default via the [EnvAccess] seam

Testing

Use [TestEnv] to inject env vars and platform directories without touching the host process. Prefer unit tests in this crate over spawning nu for pure path-resolution logic.