Skip to content

doc/stdenv: add a note about __structuredAttrs#509970

Merged
MattSturgeon merged 1 commit into
NixOS:masterfrom
jackrosenberg:push-ktmyorpwxpvp
Apr 15, 2026
Merged

doc/stdenv: add a note about __structuredAttrs#509970
MattSturgeon merged 1 commit into
NixOS:masterfrom
jackrosenberg:push-ktmyorpwxpvp

Conversation

@jackrosenberg
Copy link
Copy Markdown
Member

@jackrosenberg jackrosenberg commented Apr 14, 2026

since NixOS/nixpkgs-vet#203, CI will fail for new top level packages that do not enable __structuredAttrs. AFAIK there is little to no up to date documentation on this.

Not exactly my area of expertise, so if somebody has a better explanation on what __structuredAttrs does, feel free to drop a comment!

closes #509957, NixOS/nix#14847
based on #354949

Things done

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

@nixpkgs-ci nixpkgs-ci Bot requested a review from GetPsyched April 14, 2026 13:30
@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. 8.has: documentation This PR adds or changes documentation labels Apr 14, 2026
@jackrosenberg jackrosenberg requested a review from K900 April 14, 2026 13:39
Comment thread doc/stdenv/stdenv.chapter.md Outdated
@kirillrdy
Copy link
Copy Markdown
Member

@jackrosenberg have you seen https://nix.dev/manual/nix/2.31/language/advanced-attributes.html#adv-attr-structuredAttrs

@jackrosenberg
Copy link
Copy Markdown
Member Author

yea i found it there, but since it now affects nixpkgs/nixos i thought it would be good to add it here too. Is it okay to link to other manuals from this one, or is each manual supposed to work offline?

@MattSturgeon
Copy link
Copy Markdown
Contributor

have you seen [...]

I just commented something similar over on the related issue:

__structuredAttrs is a nix feature, not a nixpkgs feature. Its primary documentation should be in the nix manual.
-- [full comment]

@MattSturgeon
Copy link
Copy Markdown
Contributor

Is it okay to link to other manuals from this one, or is each manual supposed to work offline

That'd be a question for the docs team, if it isn't documented in the docs READMEs.

IIRC there are already a few external links in the manual, but I could be wrong.

@jackrosenberg
Copy link
Copy Markdown
Member Author

jackrosenberg commented Apr 14, 2026

IIRC there are already a few external links in the manual, but I could be wrong.

Yea, a quick rg gives plenty of results

Comment thread doc/stdenv/stdenv.chapter.md Outdated
Comment thread doc/stdenv/stdenv.chapter.md Outdated
Comment thread doc/stdenv/stdenv.chapter.md
Copy link
Copy Markdown
Contributor

@Mindavi Mindavi left a comment

Choose a reason for hiding this comment

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

I'm pretty happy with this.

@jackrosenberg jackrosenberg mentioned this pull request Apr 15, 2026
13 tasks
@nixpkgs-ci nixpkgs-ci Bot added the 12.approvals: 1 This PR was reviewed and approved by one person. label Apr 15, 2026
@jackrosenberg jackrosenberg mentioned this pull request Apr 15, 2026
13 tasks
Copy link
Copy Markdown
Member

@Eveeifyeve Eveeifyeve left a comment

Choose a reason for hiding this comment

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

I see no issues with this however @MattSturgeon might have some changes, so I would like to hear from them before merging if there is anything that is blocking this from merging.

@nixpkgs-ci nixpkgs-ci Bot added 12.approvals: 2 This PR was reviewed and approved by two persons. and removed 12.approvals: 1 This PR was reviewed and approved by one person. labels Apr 15, 2026
Copy link
Copy Markdown
Contributor

@MattSturgeon MattSturgeon left a comment

Choose a reason for hiding this comment

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

LGTM on the whole. I've left some (a lot of) minor and/or subjective wording suggestions.

The most significant things for me are putting too much emphasis on env (implicitly discouraging use of structured shell variables) and whether we need a similar warning about passAsFile?

passAsFile usage is fairly common in Nixpkgs, and its conflict with __structuredAttrs isn't explicitly called out by the upstream nix docs, other than:

This obviates the need for passAsFile since JSON files have no size restrictions, unlike process environments.

If any specific point becomes contentions, I'm happy for it to be deferred to a future PR.

Comment thread doc/stdenv/stdenv.chapter.md Outdated
Comment thread doc/stdenv/stdenv.chapter.md Outdated
Comment thread doc/stdenv/stdenv.chapter.md Outdated
Comment thread doc/stdenv/stdenv.chapter.md Outdated
Comment thread doc/stdenv/stdenv.chapter.md Outdated
Comment thread doc/stdenv/stdenv.chapter.md
Comment thread doc/stdenv/stdenv.chapter.md Outdated
Comment thread doc/stdenv/stdenv.chapter.md Outdated
Comment thread doc/stdenv/stdenv.chapter.md Outdated
Comment thread doc/stdenv/stdenv.chapter.md Outdated
@jackrosenberg
Copy link
Copy Markdown
Member Author

@MattSturgeon thanks for the in depth review! I'll take a look now :)

whether we need a similar warning about passAsFile?

sure, i don't see why not. it fits in nicely with the {.important} tag.

Comment thread doc/stdenv/stdenv.chapter.md Outdated
Copy link
Copy Markdown
Contributor

@MattSturgeon MattSturgeon left a comment

Choose a reason for hiding this comment

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

I think we can merge once https://github.com/NixOS/nixpkgs/pull/509970/changes#r3089058060 and the final nits are resolved, unless anyone has further feedback.*

*(Any significant feedback my be best as a follow-up PR, to reduce contributing friction)

Comment thread doc/stdenv/stdenv.chapter.md Outdated
Comment thread doc/stdenv/stdenv.chapter.md Outdated
Comment thread doc/stdenv/stdenv.chapter.md Outdated
Copy link
Copy Markdown
Contributor

@MattSturgeon MattSturgeon left a comment

Choose a reason for hiding this comment

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

Thanks for putting this together and sticking through the review process! LGTM

I'll merge this now, if anyone has further suggestions, improvements, nits, etc I'm happy to be pinged to review follow-up PRs.

@MattSturgeon MattSturgeon added this pull request to the merge queue Apr 15, 2026
@jackrosenberg
Copy link
Copy Markdown
Member Author

Thanks for putting this together and sticking through the review process! LGTM

My pleasure, thanks for the quick responses!

Merged via the queue into NixOS:master with commit d50cfa5 Apr 15, 2026
29 checks passed
@nixpkgs-ci nixpkgs-ci Bot added 12.approvals: 3+ This PR was reviewed and approved by three or more persons. and removed 12.approvals: 2 This PR was reviewed and approved by two persons. labels Apr 15, 2026
@jackrosenberg jackrosenberg deleted the push-ktmyorpwxpvp branch April 15, 2026 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

8.has: documentation This PR adds or changes documentation 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. 12.approvals: 3+ This PR was reviewed and approved by three or more persons.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing Documentation: __structuredAttrs

5 participants