116 The [Nix C++ API documentation](@docroot@/development/documentation.md#api-documentation) has more details on evaluator internals.
117
118 - `builtins.exec` *arguments*
119
120 Execute a program, where *arguments* are specified as a list of strings, and parse its output as a Nix expression.
121 )"};
122
123 Setting<Strings> nixPath{
124this,
125 {},
126"nix-path",
127 R"(
128 List of search paths to use for [lookup path](@docroot@/language/constructs/lookup-path.md) resolution.
129 This setting determines the value of
130 [`builtins.nixPath`](@docroot@/language/builtins.md#builtins-nixPath) and can be used with [`builtins.findFile`](@docroot@/language/builtins.md#builtins-findFile).
131
132 - The configuration setting is overridden by the [`NIX_PATH`](@docroot@/command-ref/env-common.md#env-NIX_PATH)
133 environment variable.
134 - `NIX_PATH` is overridden by [specifying the setting as the command line flag](@docroot@/command-ref/conf-file.md#command-line-flags) `--nix-path`.
135 - Any current value is extended by the [`-I` option](@docroot@/command-ref/opt-common.md#opt-I) or `--extra-nix-path`.
136
137 If the respective paths are accessible, the default values are:
138
139 - `$HOME/.nix-defexpr/channels`
140
141 The [user channel link](@docroot@/command-ref/files/default-nix-expression.md#user-channel-link), pointing to the current state of [channels](@docroot@/command-ref/files/channels.md) for the current user.
202 Pure evaluation mode ensures that the result of Nix expressions is fully determined by explicitly declared inputs, and not influenced by external state:
203
204 - Restrict file system and network access to files specified by cryptographic hash
211 As a result, every fetch must be a []{#pure-fetch}*pure fetch* — one that references immutable content:
212 [`fetchTree`](@docroot@/language/builtins.md#builtins-fetchTree) and [`fetchGit`](@docroot@/language/builtins.md#builtins-fetchGit) require a locked revision, and [`fetchTarball`](@docroot@/language/builtins.md#builtins-fetchTarball) and [`fetchurl`](@docroot@/language/builtins.md#builtins-fetchurl) require a `sha256` hash.
213 A mutable reference, such as a Git branch or tag without a revision, is rejected, since its result could otherwise change over time.
214 )"};
215
216 Setting<bool> traceImportFromDerivation{
217this,
218false,
219"trace-import-from-derivation",
220 R"(
221 By default, Nix allows [Import from Derivation](@docroot@/language/import-from-derivation.md).
222
223 When this setting is `true`, Nix logs a warning indicating that it performed such an import.
224 This option has no effect if `allow-import-from-derivation` is disabled.
225 )"};
226
227 Setting<bool> enableImportFromDerivation{
228this,
229true,
230"allow-import-from-derivation",
231 R"(
232 By default, Nix allows [Import from Derivation](@docroot@/language/import-from-derivation.md).
233
234 With this option set to `false`, Nix throws an error when evaluating an expression that uses this feature,
235 even when the required store object is readily available.
236 This ensures that evaluation doesn't require any builds to take place,
237 regardless of the state of the store.
238 )"};
239
240 Setting<Strings> allowedUris{
241this,
242 {},
243"allowed-uris",
244 R"(
245 A list of URI prefixes to which access is allowed in restricted
246 evaluation mode. For example, when set to
247 `https://github.com/NixOS`, builtin functions such as `fetchGit` are
248 allowed to access `https://github.com/NixOS/patchelf.git`.
249
250 Access is granted when
251 - the URI is equal to the prefix,
252 - or the URI is a subpath of the prefix,
253 - or the prefix is a URI scheme ended by a colon `:` and the URI has the same scheme.
254 )"};
255
256 Setting<bool> traceFunctionCalls{
257this,
258false,
259"trace-function-calls",
260 R"(
261 If set to `true`, the Nix evaluator traces every function call.
262 Nix prints a log message at the "vomit" level for every function
263 entrance and function exit.
264
265 function-trace entered undefined position at 1565795816999559622
266 function-trace exited undefined position at 1565795816999581277
267 function-trace entered /nix/store/.../example.nix:226:41 at 1565795253249935150
268 function-trace exited /nix/store/.../example.nix:226:41 at 1565795253249941684
269
270 The `undefined position` means the function call is a builtin.
271
272 Use the `contrib/stack-collapse.py` script distributed with the Nix
273 source code to convert the trace logs in to a format suitable for
274 `flamegraph.pl`.
275 )"};
276
277 Setting<EvalProfilerMode> evalProfilerMode{
278this,
279 EvalProfilerMode::disabled,
280"eval-profiler",
281 R"(
282 Enables evaluation profiling. The following modes are supported:
283
284 * `flamegraph` stack sampling profiler. Outputs folded format, one line per stack (suitable for `flamegraph.pl` and compatible tools).
285
286 Use [`eval-profile-file`](#conf-eval-profile-file) to specify where the profile is saved.
287
288 See [Using the `eval-profiler`](@docroot@/advanced-topics/eval-profiler.md).
350 This is useful for debugging warnings in third-party Nix code.
351 )"};
352
353 Setting<bool> builtinsDebuggerOnWarn{
354this,
355false,
356"debugger-on-warn",
357 R"(
358 If set to true and the `--debugger` flag is given, [`builtins.warn`](@docroot@/language/builtins.md#builtins-warn)
359 will enter the debugger like [`builtins.break`](@docroot@/language/builtins.md#builtins-break).
360
361 This is useful for debugging warnings in third-party Nix code.
362
363 Use [`debugger-on-trace`](#conf-debugger-on-trace) to also enter the debugger on legacy warnings that are logged with [`builtins.trace`](@docroot@/language/builtins.md#builtins-trace).
364 )"};
365
366 Setting<bool> builtinsAbortOnWarn{
367this,
368false,
369"abort-on-warn",
370 R"(
371 If set to true, [`builtins.warn`](@docroot@/language/builtins.md#builtins-warn) throws an error when logging a warning.
372
373 This will give you a stack trace that leads to the location of the warning.
374
375 This is useful for finding information about warnings in third-party Nix code when you can not start the interactive debugger, such as when Nix is called from a non-interactive script. See [`debugger-on-warn`](#conf-debugger-on-warn).
376
377 Currently, a stack trace can only be produced when the debugger is enabled, or when evaluation is aborted.
378
379 This option can be enabled by setting `NIX_ABORT_ON_WARN=1` in the environment.
380 )"};
381
382 Setting<Diagnose> lintShortPathLiterals{
383this,
384 Diagnose::Ignore,
385"lint-short-path-literals",
386 R"(
387 Controls handling of relative path literals that don't start with `./` or `../`.
388
389 - `ignore`: Ignore without warning (default)
390 - `warn`: Emit a warning suggesting to use `./` prefix
391 - `fatal`: Treat as a parse error
392
393 For example, with this setting set to `warn` or `fatal`, `foo/bar` would
394 suggest using `./foo/bar` instead.
395
396 This is useful for improving code readability and making path literals
397 more explicit.
398 )",
399 };
400
401 DeprecatedWarnSetting warnShortPathLiterals{
402this,
403 lintShortPathLiterals,
404"lint-short-path-literals",
405"warn-short-path-literals",
406 R"(
407 Deprecated. Use [`lint-short-path-literals`](#conf-lint-short-path-literals)` = warn` instead.
408 )",
409 };
410
411 Setting<Diagnose> lintAbsolutePathLiterals{
412this,
413 Diagnose::Ignore,
414"lint-absolute-path-literals",
415 R"(
416 Controls handling of absolute path literals (paths starting with `/`) and home path literals (paths starting with `~/`).
417
418 - `ignore`: Ignore without warning (default)
419 - `warn`: Emit a warning about non-portability
420 - `fatal`: Treat as a parse error
421
422 It is true that some files are more difficult to reference with relative paths,
423 because they would require lots of `../../..` upward traversing to reach them.
424 But firstly, it is probably not a good idea to reference these files ---
425 such paths often make Nix expressions less portable and reproducible,
426 as they depend on the file system layout of the machine evaluating the expression.
427
428 Secondly, with [pure evaluation mode](#conf-pure-eval), most such files are prohibited to access anyway,
429 whether by absolute or relative paths.
430 In that case, enabling this lint in fatal mode is less disruptive,
431 because the paths pure eval allows are usually not the ones that would be ergonomically expressed with absolute paths anyway.
432 )",
433 };
434
435 Setting<Diagnose> lintUrlLiterals{
436this,
437 Diagnose::Ignore,
438"lint-url-literals",
439 R"(
440 Controls handling of unquoted URLs as part of the Nix language syntax.
441 The Nix language allows for URL literals, like so:
442
443 ```
444 $ nix repl
445 nix-repl> http://foo
446 "http://foo"
447 ```
448
449 Setting this to `warn` or `fatal` will cause the Nix parser to
450 warn or throw an error when encountering a URL literal:
451
452 ```
453 $ nix repl --lint-url-literals fatal
454 nix-repl> http://foo
455 error: URL literal 'http://foo' is deprecated
456 at «string»:1:1:
457
458 1| http://foo
459 | ^
460 ```
461
462 Unquoted URLs are being deprecated and their usage is discouraged.
463
464 The reason is that, as opposed to path literals, URLs have no
465 special properties that distinguish them from regular strings, URLs
466 containing query parameters have to be quoted anyway, and unquoted URLs