doc: add __structuredAttrs, outputChecks, unsafeDiscardReferences#7714
doc: add __structuredAttrs, outputChecks, unsafeDiscardReferences#7714thufschmitt merged 1 commit intoNixOS:masterfrom
__structuredAttrs, outputChecks, unsafeDiscardReferences#7714Conversation
thufschmitt
left a comment
There was a problem hiding this comment.
Thanks a lot for taking the time to write this down!
fricklerhandwerk
left a comment
There was a problem hiding this comment.
@ncfavier sorry for the post-factum review, I was on vacation. Would be great if you could make a follow-up to address the suggestions you agree with. Those are for having a more predictable presentation of notes and examples, and, of course, adding links.
| If the special attribute `__structuredAttrs` is set to `true`, the other derivation | ||
| attributes are serialised in JSON format and made available to the | ||
| builder via the file `.attrs.json` in the builder’s temporary | ||
| directory. This obviates the need for `passAsFile` since JSON files |
There was a problem hiding this comment.
Please add a link to passAsFile.
| [`disallowedReferences`](#adv-attr-disallowedReferences) and [`disallowedRequisites`](#adv-attr-disallowedRequisites), | ||
| the following attributes are available: | ||
|
|
||
| - `maxSize` defines the maximum size of the output path. |
There was a problem hiding this comment.
| - `maxSize` defines the maximum size of the output path. | |
| - `maxSize` defines the maximum size of the resulting [store object](../glossary.md#gloss-store-object). |
Saying that a path has a size makes me think that we somehow mean the length of the string signifying the path, which doesn't make sense. It's the store object that can have a size.
| - `maxClosureSize` defines the maximum size of the output's closure. | ||
| - `ignoreSelfRefs` controls whether self-references should be considered when | ||
| checking for allowed references/requisites. | ||
|
|
There was a problem hiding this comment.
| Example: | |
| When using [structured attributes](#adv-attr-structuredAttrs), the **experimental** | ||
| attribute `unsafeDiscardReferences` is a per-output boolean which, if set to `true`, | ||
| disables scanning the build output for runtime dependencies altogether. |
There was a problem hiding this comment.
| When using [structured attributes](#adv-attr-structuredAttrs), the **experimental** | |
| attribute `unsafeDiscardReferences` is a per-output boolean which, if set to `true`, | |
| disables scanning the build output for runtime dependencies altogether. | |
| > **Warning** | |
| > This is an experimental feature. | |
| > | |
| > To enable it, add the following to [nix.conf](../command-ref/conf-file.md): | |
| > | |
| > ``` | |
| > extra-experimental-features = discard-references | |
| > ``` | |
| When using [structured attributes](#adv-attr-structuredAttrs), the | |
| attribute `unsafeDiscardReferences` is an attribute set with a boolean value for each output name. | |
| If set to `true`, it disables scanning the output for runtime dependencies. | |
| Example: |
|
|
||
| This is only allowed if the `discard-references` experimental feature is enabled. |
There was a problem hiding this comment.
| This is only allowed if the `discard-references` experimental feature is enabled. |
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: |
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: |
Follow-up to #7087, fixes #7429 (@roberth), fixes #7537.