-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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
lib.packagesFromDirectoryRecursive: use explicit recursion, support nested scopes #359984
base: master
Are you sure you want to change the base?
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
1753d6d
to
4c6c2ec
Compare
Ran |
Rebased following the parent PR being merged |
4c6c2ec
to
8a5830c
Compare
I'd prefer to land #359898 first, as there will be a merge conflict over the function's documentation, and having the improved documentation will make documenting this PR's changes simpler. PS: Marked as draft again, since I'll wait for that to land before writing documentation in this PR. |
85b9516
to
ecca66e
Compare
Rebased atop both blocking PRs, added documentation. Still needs an example how to use |
Fixed up the release notes, putting those entries under the |
@NixOS/ofborg-maintainers, where does one get details on that I'm guessing @ofborg choked on something which it wasn't previously recursing into, possibly the FreeBSD-specific packages? (for which it has no builder) |
…en `newScope` is provided Co-authored-by: Rebecca Turner <[email protected]>
Fixes a bug preventing `recurseIntoDirectory` from changing the `directory` argument. Moreover, `processDir` now cannot capture arguments from the `packagesFromDirectoryRecursive` call, entirely preventing this class of bug from reoccurring should new parameters be added etc.
Squashed |
e2bff52
to
3627f0a
Compare
This comment was marked as outdated.
This comment was marked as outdated.
Using |
3627f0a
to
0fe9ad2
Compare
|
This is only waiting for reviews, no functional change since the beginning of the month: only rebased to address the merge conflict and squash fixup commits, and moved the release notes entries. (One further change was tried and reverted, to be done in #369421) @9999years if you re-review, I think we could get that merged soonish |
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.
Nice changes. Thank you for the efforts that you already put into it.
# recurseIntoDirectory can modify the function used when processing directory entries | ||
# and recurseArgs can (optionally) hold data for its use ; see nixdoc above | ||
recurseArgs ? throw "lib.packagesFromDirectoryRecursive: recurseArgs wasn't passed in args", | ||
recurseIntoDirectory ? |
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 function could be its own unit. For example defaultRecurseIntoDirectory
. This makes it possible to unit-test and reuse this function. I think inline here is a little bit unhappy.
Also this inline documentation as plain comment will not render into any documentation.
If you pull this out you can write a nice doc-comment describing the behavior.
Place mutual references in the parent function-library-lib.filesets.packagesFromDirectoryRecursive
This will make it much easier for people to understand and implement their own function if needed.
/**
Create a new scope and mark it `recurseForDerivations`.
This lets the packages refer to each other.
See also:
- [lib.makeScope](https://nixos.org/manual/nixpkgs/unstable/#function-library-lib.customisation.makeScope) and
- [lib.recurseIntoAttrs](https://nixos.org/manual/nixpkgs/unstable/#function-library-lib.customisation.makeScope)
*/
defaultRecurseIntoDirectory = args: if args ? newScope then ...
... | ||
}: | ||
# recurseIntoDirectory can modify the function used when processing directory entries | ||
# and recurseArgs can (optionally) hold data for its use ; see nixdoc above |
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.
# and recurseArgs can (optionally) hold data for its use ; see nixdoc above | |
# and recurseArgs can (optionally) hold data for its use ; see comment above |
[`lib.packagesFromDirectoryRecursive`]: https://nixos.org/manual/nixpkgs/stable/#function-library-lib.filesystem.packagesFromDirectoryRecursive | ||
[`lib.recurseIntoAttrs`]: https://nixos.org/manual/nixpkgs/stable/#function-library-lib.attrsets.recurseIntoAttrs | ||
|
||
### Other notable changes {#sec-release-25.05-lib-notable-changes} |
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.
It seems we used a different heading in all the previous release notes:
### Other notable changes {#sec-release-25.05-lib-notable-changes} | |
### Additions and Improvements {#sec-release-25.05-lib-additions-improvements} |
Follow-up on #359941, blocked on it as this PR contains commits from it.Blocked on
#359898 and#361424.lib.filesystem.packagesFromDirectoryRecursive
with support for explicit recursion.packagesFromDirectoryRecursive
to create nested scopes for each (sub)directory (not just the top-level one) whennewScope
is given.recurseIntoAttrs
by default when recursing into a directory.packagesFromDirectoryRecursive
, ensuring:recurseIntoDirectory
.Things done
nix-instantiate --eval --strict lib/tests/misc.nix
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.