Skip to content
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

Merged
merged 1 commit into from
Jan 31, 2023

Conversation

ncfavier
Copy link
Member

Follow-up to #7087, fixes #7429 (@roberth), fixes #7537.

screenshot

@ncfavier ncfavier mentioned this pull request Jan 30, 2023
2 tasks
Copy link
Member

@thufschmitt thufschmitt left a 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!

@thufschmitt thufschmitt merged commit 0079d29 into NixOS:master Jan 31, 2023
@ncfavier ncfavier deleted the doc-structuredAttrs branch January 31, 2023 13:44
Copy link
Contributor

@fricklerhandwerk fricklerhandwerk left a 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
Copy link
Contributor

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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- `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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Example:

Comment on lines +308 to +310
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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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:

Comment on lines +320 to +321

This is only allowed if the `discard-references` experimental feature is enabled.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This is only allowed if the `discard-references` experimental feature is enabled.

@ncfavier ncfavier mentioned this pull request Feb 7, 2023
@nixos-discourse
Copy link

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

@nixos-discourse
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Document outputChecks Document __structuredAttrs
4 participants