nh

Automate NixOS, Home Manager, and nix-darwin maintenance tasks via the nh CLI.

68|1|Updated Jan 14, 2026
One-click install
npx skills add https://github.com/knoopx/pi --skill nh
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: nh
Source: https://github.com/knoopx/pi/tree/main/agent/skills/nh
Command: npx skills add https://github.com/knoopx/pi --skill nh

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

nh simplifies and automates NixOS, Home Manager, and related maintenance tasks, reducing manual configuration overhead.

Core Features & Use Cases

  • System updates, switches, and garbage collection for NixOS configurations via nh os (build, switch, test, boot, rollback, info, build-vm, repl).
  • Home Manager updates and configuration handling via nh home (switch, build, repl).
  • Nix-Darwin support for macOS configurations via nh darwin (switch, build).
  • Package discovery and workflow enhancements such as package search with nh search.
  • Maintenance and cleanup through nh clean to manage Nix stores and profiles.

Quick Start

Use the nh skill to perform common operations:

  • nh os switch path:.
  • nh os test path:.
  • nh os build path:.
  • nh os boot path:.
  • nh os rollback
  • nh os info
  • nh os build-vm path:.
  • tmux new -d -s nh-repl 'nh os repl path:.'
  • nh home switch path:.
  • nh home build path:.
  • tmux new -d -s hm-repl 'nh home repl path:.'
  • nh darwin switch path:.
  • nh darwin build path:.

Frequently Asked Questions about nh

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I switch NixOS configurations using a flake?▼

To switch NixOS configurations, use the command `nh os switch path:.` to apply your flake.nix configuration. This replaces manual nixos-rebuild commands with a streamlined update process.

Can I manage Home Manager configurations through nh?▼

Yes, you can manage Home Manager through nh using the `nh home` subcommand. Run `nh home switch path:.` or `nh home build path:.` to apply or build your home configuration directly from a flake.

Does nh support nix-darwin for macOS system configuration?▼

Yes, nh supports nix-darwin for macOS configurations. Use the `nh darwin switch path:.` and `nh darwin build path:.` subcommands to apply and build your macOS system setup via flakes.

What is the best way to clean up old NixOS generations and garbage?▼

The best way to clean old generations and garbage is the `nh clean` command. It manages Nix stores and profiles, automating the removal of outdated generations to free up system disk space.

How do I start an interactive NixOS repl session with tmux?▼

To start an interactive NixOS repl session, use `tmux new -d -s nh-repl 'nh os repl path:.'`. This launches the repl in a detached tmux session for interactive configuration testing.