Loading...
Loading...
Switches NixOS/Home Manager configurations, cleans old generations, and performs system maintenance. Use when running os/home switch, pruning the Nix store, or managing system generations.
npx skill4agent add knoopx/pi nhnh ospath:# Build and switch to a configuration (equivalent to nixos-rebuild switch)
nh os switch path:.
# Build and test a configuration (equivalent to nixos-rebuild test)
nh os test path:.
# Build a configuration without switching (equivalent to nixos-rebuild build)
nh os build path:.
# Make configuration the boot default without activating
nh os boot path:.
# Rollback to a previous generation
nh os rollback
# List available generations
nh os info
# Build a NixOS VM image
nh os build-vm path:.
# Load system configuration in a REPL (use tmux for interactive)
tmux new -d -s nh-repl 'nh os repl path:.'nh home# Build and switch Home Manager configuration
nh home switch path:.
# Build Home Manager configuration without switching
nh home build path:.
# Load Home Manager configuration in a REPL (use tmux for interactive)
tmux new -d -s hm-repl 'nh home repl path:.'nh darwin# Build and switch darwin configuration
nh darwin switch path:.
# Build darwin configuration without switching
nh darwin build path:.# Search for packages
nh search ripgrepnh clean# Clean all profiles (system + user)
nh clean all --keep-since 7d
# Clean only current user's profiles
nh clean user --keep 5
# Clean a specific profile
nh clean profile /nix/var/nix/profiles/system --keep 3
# Run garbage collection on the Nix store
nh clean all--ask--dry--update--asknhflake.nixnh