Document store URLs

This commit is contained in:
Eelco Dolstra 2023-03-23 10:38:48 +01:00
parent 05d9918a9c
commit 161f4b0dea
3 changed files with 49 additions and 6 deletions

View file

@ -136,7 +136,11 @@ MixEvalArgs::MixEvalArgs()
addFlag({ addFlag({
.longName = "eval-store", .longName = "eval-store",
.description = "The Nix store to use for evaluations.", .description =
R"(
The [URL of the Nix store](@docroot@/command-ref/new-cli/nix3-help-stores.md#store-url-format)
to use for evaluation, i.e. to store derivations (`.drv` files) and inputs referenced by them.
)",
.category = category, .category = category,
.labels = {"store-url"}, .labels = {"store-url"},
.handler = {&evalStoreUrl}, .handler = {&evalStoreUrl},

View file

@ -98,7 +98,9 @@ public:
Setting<std::string> storeUri{this, getEnv("NIX_REMOTE").value_or("auto"), "store", Setting<std::string> storeUri{this, getEnv("NIX_REMOTE").value_or("auto"), "store",
R"( R"(
The URL of the Nix store to use. See [`nix help-stores`](@docroot@/command-ref/new-cli/nix3-help-stores.md) The [URL of the Nix store](@docroot@/command-ref/new-cli/nix3-help-stores.md#store-url-format)
to use for most operations.
See [`nix help-stores`](@docroot@/command-ref/new-cli/nix3-help-stores.md)
for supported store types and settings. for supported store types and settings.
)"}; )"};
@ -681,8 +683,9 @@ public:
Strings{"https://cache.nixos.org/"}, Strings{"https://cache.nixos.org/"},
"substituters", "substituters",
R"( R"(
A list of URLs of substituters, separated by whitespace. Substituters A list of [URLs of Nix stores](@docroot@/command-ref/new-cli/nix3-help-stores.md#store-url-format)
are tried based on their Priority value, which each substituter can set to be used as substituters, separated by whitespace.
Substituters are tried based on their Priority value, which each substituter can set
independently. Lower value means higher priority. independently. Lower value means higher priority.
The default is `https://cache.nixos.org`, with a Priority of 40. The default is `https://cache.nixos.org`, with a Priority of 40.
@ -700,7 +703,8 @@ public:
Setting<StringSet> trustedSubstituters{ Setting<StringSet> trustedSubstituters{
this, {}, "trusted-substituters", this, {}, "trusted-substituters",
R"( R"(
A list of URLs of substituters, separated by whitespace. These are A list of [URLs of Nix stores](@docroot@/command-ref/new-cli/nix3-help-stores.md#store-url-format),
separated by whitespace. These are
not used by default, but can be enabled by users of the Nix daemon not used by default, but can be enabled by users of the Nix daemon
by specifying `--option substituters urls` on the command by specifying `--option substituters urls` on the command
line. Unprivileged users are only allowed to pass a subset of the line. Unprivileged users are only allowed to pass a subset of the

View file

@ -4,7 +4,42 @@ Nix supports different types of stores. These are described below.
## Store URL format ## Store URL format
TODO Stores are specified using a URL-like syntax. For example, the command
```console
# nix path-info --store https://cache.nixos.org/ --json \
/nix/store/a7gvj343m05j2s32xcnwr35v31ynlypr-coreutils-9.1
```
fetches information about a store path in the HTTP binary cache
located at https://cache.nixos.org/, which is a type of store.
Store URLs can specify **store settings** using URL query strings,
i.e. by appending `?name1=value1&name2=value2&...` to the URL. For
instance,
```
--store ssh://machine.example.org?ssh-key=/path/to/my/key
```
tells Nix to access the store on a remote machine via the SSH
protocol, using `/path/to/my/key` as the SSH private key. The
supported settings for each store type are documented below.
The special store URL `auto` causes Nix to automatically select a
store as follows:
* Use the local store `/nix/store` if `/nix/var/nix` is writable by
the current user.
* Otherwise, if `/nix/var/nix/daemon-socket/socket` exists, [connect
to the Nix daemon listening on that socket](#local-daemon-store).
* Otherwise, on Linux only, use the local chroot store
`~/.local/share/nix/root`, which will be created automatically if it
does not exist.
* Otherwise, use the local store `/nix/store`.
@stores@ @stores@