Linux

Where Does nh Store Config on Linux?

nh Nix helper TOML config and GitHub token state file on Linux.

Last updated

nh keeps two small files. A TOML config holds flake and behavior defaults under XDG config. A GitHub token file sits under XDG state for authenticated fetches.

An env var overrides the config path and another points at an alternate token file. Remaining options flow through env at runtime. Both files are plain text, so guard the token.

Where nh stores this, by platform

Linux
~/.config/nh/config.toml

TOML defaults under the nh config dir with env override. Token file under XDG state with its own override. Remaining behavior through runtime env vars.

Frequently asked questions

How do I back up nh?

Copy config.toml plus the token file with no nh command running. Flake aliases and defaults travel in TOML. Restoring means putting both back with matching permissions on the token.

JSON or TOML?

Not nh.json. The config is TOML under the nh config dir with an env override. Token state lives separately under XDG state. Env vars cover the rest at runtime.

Notice an outdated path? Let us know.