mirror of
https://github.com/NixOS/nix.git
synced 2024-11-26 00:32:28 +00:00
document where the value of builtins.nixPath
comes from (#9113)
* document default values for `nix-path` also note how it's overridden and note the effect of `restrict-eval`
This commit is contained in:
parent
3120fef01b
commit
ac730622e8
@ -21,11 +21,24 @@ struct EvalSettings : Config
|
|||||||
Setting<Strings> nixPath{
|
Setting<Strings> nixPath{
|
||||||
this, getDefaultNixPath(), "nix-path",
|
this, getDefaultNixPath(), "nix-path",
|
||||||
R"(
|
R"(
|
||||||
List of directories to be searched for `<...>` file references
|
List of search paths to use for [lookup path](@docroot@/language/constructs/lookup-path.md) resolution.
|
||||||
|
This setting determines the value of
|
||||||
|
[`builtins.nixPath`](@docroot@/language/builtin-constants.md#builtins-nixPath) and can be used with [`builtins.findFile`](@docroot@/language/builtin-constants.md#builtins-findFile).
|
||||||
|
|
||||||
In particular, outside of [pure evaluation mode](#conf-pure-eval), this determines the value of
|
The default value is
|
||||||
[`builtins.nixPath`](@docroot@/language/builtin-constants.md#builtins-nixPath).
|
|
||||||
)"};
|
```
|
||||||
|
$HOME/.nix-defexpr/channels
|
||||||
|
nixpkgs=$NIX_STATE_DIR/profiles/per-user/root/channels/nixpkgs
|
||||||
|
$NIX_STATE_DIR/profiles/per-user/root/channels
|
||||||
|
```
|
||||||
|
|
||||||
|
It can be overridden with the [`NIX_PATH` environment variable](@docroot@/command-ref/env-common.md#env-NIX_PATH) or the [`-I` command line option](@docroot@/command-ref/opt-common.md#opt-I).
|
||||||
|
|
||||||
|
> **Note**
|
||||||
|
>
|
||||||
|
> If [pure evaluation](#conf-pure-eval) is enabled, `nixPath` evaluates to the empty list `[ ]`.
|
||||||
|
)", {}, false};
|
||||||
|
|
||||||
Setting<std::string> currentSystem{
|
Setting<std::string> currentSystem{
|
||||||
this, "", "eval-system",
|
this, "", "eval-system",
|
||||||
@ -55,8 +68,6 @@ struct EvalSettings : Config
|
|||||||
[`builtins.nixPath`](@docroot@/language/builtin-constants.md#builtins-nixPath),
|
[`builtins.nixPath`](@docroot@/language/builtin-constants.md#builtins-nixPath),
|
||||||
or to URIs outside of
|
or to URIs outside of
|
||||||
[`allowed-uris`](@docroot@/command-ref/conf-file.md#conf-allowed-uris).
|
[`allowed-uris`](@docroot@/command-ref/conf-file.md#conf-allowed-uris).
|
||||||
|
|
||||||
Also the default value for [`nix-path`](#conf-nix-path) is ignored, such that only explicitly set search path entries are taken into account.
|
|
||||||
)"};
|
)"};
|
||||||
|
|
||||||
Setting<bool> pureEval{this, false, "pure-eval",
|
Setting<bool> pureEval{this, false, "pure-eval",
|
||||||
|
@ -1736,7 +1736,7 @@ static RegisterPrimOp primop_findFile(PrimOp {
|
|||||||
- If the suffix is found inside that directory, then the entry is a match.
|
- If the suffix is found inside that directory, then the entry is a match.
|
||||||
The combined absolute path of the directory (now downloaded if need be) and the suffix is returned.
|
The combined absolute path of the directory (now downloaded if need be) and the suffix is returned.
|
||||||
|
|
||||||
[Lookup path](@docroot@/language/constructs/lookup-path.md) expressions can be [desugared](https://en.wikipedia.org/wiki/Syntactic_sugar) using this and [`builtins.nixPath`](@docroot@/language/builtin-constants.md#builtins-nixPath):
|
[Lookup path](@docroot@/language/constructs/lookup-path.md) expressions are [desugared](https://en.wikipedia.org/wiki/Syntactic_sugar) using this and [`builtins.nixPath`](@docroot@/language/builtin-constants.md#builtins-nixPath):
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
<nixpkgs>
|
<nixpkgs>
|
||||||
@ -4570,11 +4570,9 @@ void EvalState::createBaseEnv()
|
|||||||
addConstant("__nixPath", v, {
|
addConstant("__nixPath", v, {
|
||||||
.type = nList,
|
.type = nList,
|
||||||
.doc = R"(
|
.doc = R"(
|
||||||
List of search path entries used to resolve [lookup paths](@docroot@/language/constructs/lookup-path.md).
|
The value of the [`nix-path` configuration setting](@docroot@/command-ref/conf-file.md#conf-nix-path): a list of search path entries used to resolve [lookup paths](@docroot@/language/constructs/lookup-path.md).
|
||||||
|
|
||||||
Lookup path expressions can be
|
Lookup path expressions are [desugared](https://en.wikipedia.org/wiki/Syntactic_sugar) using this and
|
||||||
[desugared](https://en.wikipedia.org/wiki/Syntactic_sugar)
|
|
||||||
using this and
|
|
||||||
[`builtins.findFile`](./builtins.html#builtins-findFile):
|
[`builtins.findFile`](./builtins.html#builtins-findFile):
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
|
Loading…
Reference in New Issue
Block a user