-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
doc: add __structuredAttrs
, outputChecks
, unsafeDiscardReferences
#7714
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for taking the time to write this down!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- `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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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: https://discourse.nixos.org/t/tweag-nix-dev-update-44/25546/1 |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/nix-team-report-2022-10-2023-03/27486/1 |
Follow-up to #7087, fixes #7429 (@roberth), fixes #7537.