Skip to content

Latest commit

 

History

History
44 lines (32 loc) · 1.33 KB

File metadata and controls

44 lines (32 loc) · 1.33 KB

Using Devbox with Nushell

Devbox now supports nushell through the --format flag on the shellenv command.

Quick Start

Add this to ~/.config/nushell/env.nu:

devbox global shellenv --format nushell --preserve-path-stack -r
  | lines 
  | parse "$env.{name} = \"{value}\""
  | where name != null 
  | transpose -r 
  | into record 
  | load-env

This is equivalent to bash's eval "$(devbox global shellenv)" and runs on every fresh shell start.


Global Configuration

To use devbox global packages with nushell, you need to load the environment similar to how bash/zsh use eval "$(devbox global shellenv)".

Dynamic loading with load-env - eval equivalent

Add this to ~/.config/nushell/env.nu to regenerate and load devbox environment fresh every time, just like bash's eval:

# Load devbox global environment dynamically (equivalent to bash eval)
devbox global shellenv --format nushell --preserve-path-stack -r
  | lines 
  | parse "$env.{name} = \"{value}\""
  | where name != null 
  | transpose -r 
  | into record 
  | load-env
  • --format nushell - Output in nushell syntax
  • --preserve-path-stack - Maintain existing PATH order if devbox is already active
  • -r (recompute) - Always recompute the environment, prevents "out of date" warnings