reword documentation on settings and attributes related to substitution

- add links
- be more concise
- clarify the distinction between `preferLocalBuild` and `allowSubstitutes`
This commit is contained in:
Valentin Gagarin 2023-12-02 02:21:17 +01:00
parent 84fe429dfd
commit 51adfb9b27
2 changed files with 7 additions and 20 deletions

View file

@ -257,29 +257,18 @@ Derivations can declare some infrequently used optional attributes.
of the environment (typically, a few hundred kilobyte). of the environment (typically, a few hundred kilobyte).
- [`preferLocalBuild`]{#adv-attr-preferLocalBuild}\ - [`preferLocalBuild`]{#adv-attr-preferLocalBuild}\
If this attribute is set to `true` and [distributed building is If this attribute is set to `true` and [distributed building is enabled](../advanced-topics/distributed-builds.md), then, if possible, the derivation will be built locally instead of being forwarded to a remote machine.
enabled](../advanced-topics/distributed-builds.md), then, if This is useful for derivations that are cheapest to build locally.
possible, the derivation will be built locally instead of forwarded
to a remote machine. This is appropriate for trivial builders
where the cost of doing a download or remote build would exceed
the cost of building locally.
- [`allowSubstitutes`]{#adv-attr-allowSubstitutes}\ - [`allowSubstitutes`]{#adv-attr-allowSubstitutes}\
If this attribute is set to `false`, then Nix will always build this If this attribute is set to `false`, then Nix will always build this derivation (locally or remotely); it will not try to substitute its outputs.
derivation; it will not try to substitute its outputs. This is This is useful for derivations that are cheaper to build than to substitute.
useful for very trivial derivations (such as `writeText` in Nixpkgs)
that are cheaper to build than to substitute from a binary cache.
You may disable the effects of this attibute by enabling the This attribute can be ignored by setting [`always-allow-substitutes`](@docroot@/command-ref/conf-file.md#conf-always-allow-substitutes) to `true`.
`always-allow-substitutes` configuration option in Nix.
> **Note** > **Note**
> >
> You need to have a builder configured which satisfies the > If set to `false`, the [`builder`](./derivations.md#attr-builder) should be able to run on the system type specified in the [`system` attribute](./derivations.md#attr-system), since the derivation cannot be substituted.
> derivations `system` attribute, since the derivation cannot be
> substituted. Thus it is usually a good idea to align `system` with
> `builtins.currentSystem` when setting `allowSubstitutes` to
> `false`. For most trivial derivations this should be the case.
- [`__structuredAttrs`]{#adv-attr-structuredAttrs}\ - [`__structuredAttrs`]{#adv-attr-structuredAttrs}\
If the special attribute `__structuredAttrs` is set to `true`, the other derivation If the special attribute `__structuredAttrs` is set to `true`, the other derivation

View file

@ -268,9 +268,7 @@ public:
Setting<bool> alwaysAllowSubstitutes{ Setting<bool> alwaysAllowSubstitutes{
this, false, "always-allow-substitutes", this, false, "always-allow-substitutes",
R"( R"(
If set to `true`, Nix will ignore the `allowSubstitutes` attribute in If set to `true`, Nix will ignore the [`allowSubstitutes`](@docroot@/language/advanced-attributes.md) attribute in derivations and always attempt to use [available substituters](#conf-substituters).
derivations and always attempt to use available substituters.
For more information on `allowSubstitutes`, see [the manual chapter on advanced attributes](../language/advanced-attributes.md).
)"}; )"};
Setting<bool> buildersUseSubstitutes{ Setting<bool> buildersUseSubstitutes{