@@ -215,6 +215,54 @@ The config would look like this:
215215}
216216```
217217
218+ ## Environment variables
219+
220+ NH supports several environment variables to control command behaviour. Some of
221+ the common variables that you may encounter or choose to employ are as follows:
222+
223+ - ` NH_NO_CHECKS `
224+ - When set (any non-empty value), skips startup checks such as Nix version and
225+ experimental feature validation. Useful for generating completions or
226+ running in constrained build environments. You can also consider this an
227+ "expert flag" that you can set for a non-zero performance benefit. It
228+ assumes you know what you are doing.
229+
230+ - ` NH_FLAKE `
231+ - Preferred flake path/reference used by NH when running flake-based commands.
232+ Historically ` FLAKE ` was used; NH will migrate ` FLAKE ` into ` NH_FLAKE ` if
233+ present and the specific ` NH_*_FLAKE ` vars are not set.
234+
235+ - ` NH_OS_FLAKE ` , ` NH_HOME_FLAKE ` , ` NH_DARWIN_FLAKE `
236+ - Command-specific flake references for ` os ` , ` home ` , and ` darwin ` commands
237+ respectively. If present they take precedence over ` NH_FLAKE ` .
238+
239+ - ` NH_SUDO_ASKPASS `
240+ - Path to a program used as ` SUDO_ASKPASS ` when NH self-elevates with ` sudo ` .
241+ If set and ` sudo ` is used for elevation, NH will pass ` -A ` to ` sudo ` and set
242+ ` SUDO_ASKPASS ` accordingly.
243+
244+ - ` NH_PRESERVE_ENV `
245+ - Controls whether environment variables marked for preservation are passed to
246+ elevated commands. Set to ` "0" ` to disable preservation, ` "1" ` to force
247+ preservation. If unset, preservation defaults to enabled.
248+
249+ - ` NH_LOG `
250+ - Sets the tracing/log filter for NH. This uses the same format as
251+ ` tracing_subscriber ` env filters (for example: ` nh=trace ` ).
252+
253+ - ` NH_NOM `
254+ - Control whether ` nom ` (nix-output-monitor) should be enabled for the build
255+ processes. Equivalent of ` --no-nom ` .
256+
257+ ### Notes
258+
259+ - Any environment variables prefixed with ` NH_ ` are explicitly propagated by NH
260+ to commands when appropriate.
261+ - For backwards compatibility, if ` FLAKE ` is present and none of the
262+ command-specific ` NH_*_FLAKE ` variables exist, NH will set ` NH_FLAKE ` from
263+ ` FLAKE ` and emit a warning recommending migration to ` NH_FLAKE ` . ` FLAKE ` will
264+ be removed in the future versions of NH.
265+
218266## Hacking
219267
220268Contributions are always welcome. To get started, just clone the repository and
0 commit comments