-
-
Notifications
You must be signed in to change notification settings - Fork 14
[WIP] Multiple by-name directory support #180
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
Draft
mdaniels5757
wants to merge
21
commits into
NixOS:main
Choose a base branch
from
mdaniels5757:multi-by-name
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
2b5ceae
Tests pass, but that's all that works currently.
mdaniels5757 54d5acc
Some changes, also run fmt
mdaniels5757 4054e34
now broken in a different way
mdaniels5757 50655ee
tests are passing again now
mdaniels5757 d3c3cb9
clippy + fmt
mdaniels5757 0efc5bf
use fixtures crate to put all tests into cargo output
mdaniels5757 1c66e08
use env var for config
mdaniels5757 d228d28
Works?
mdaniels5757 ce852a1
move concurrency to each by-name-dir check
mdaniels5757 572e8b7
doc config
mdaniels5757 7757cc2
combine multiple evaluations into one (well, two)
mdaniels5757 945f246
misc work, display only the correct by-name directory when erroring
mdaniels5757 8cc9474
fix: use a wildcard that doesn't match nested attrs
mdaniels5757 c9a9a35
tests now pass again, including my new ones!
mdaniels5757 0450bb5
don't perform extra logging
mdaniels5757 7e0fa3f
treefmt
mdaniels5757 b131c34
enable python by-name dir
mdaniels5757 bba094b
seperate test dirs by attrset
mdaniels5757 54891e7
fix CI build
mdaniels5757 3438417
clippy
mdaniels5757 0d147d5
Copied all tests and modified them to work with tcl. All pass!
mdaniels5757 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| target | ||
| .direnv | ||
| result* | ||
| by-name-config-generated.json |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| # Configure by-name directories in this file. | ||
| # Then build with `nix-build -A build` to automatically generate by-name-config-generated.json | ||
| # (Or, to generate manually, `nix-instantiate --eval --json --strict by-name-config.nix > by-name-config-generated.json`) | ||
| # In the attrsets that make up by_name_dirs: | ||
| # * The aliases_path field is optional. | ||
| # * The ID field must be short and unique. | ||
| # * Exactly one attr_path_regex must be a wildcard ("^[^\\.]*$"). | ||
| # * All non-wildcard attr_path_regexes must be mutually exclusive. | ||
| # * Exactly one unversioned_attr_prefix must be the empty string. | ||
| # * All non-wildcard unversioned_attr_prefixes must be mutually exclusive. | ||
| { | ||
| by_name_dirs = [ | ||
| { | ||
| id = "py"; | ||
| path = "pkgs/development/python-modules/by-name"; | ||
| attr_path_regex = "^(python3\\d*Packages|python3\\d*.pkgs)\\..*$"; | ||
| unversioned_attr_prefix = "python3Packages"; | ||
| all_packages_path = "/pkgs/top-level/python-packages.nix"; | ||
| aliases_path = "/pkgs/top-level/python-aliases.nix"; | ||
| } | ||
| { | ||
| id = "tcl"; | ||
| path = "pkgs/development/tcl-modules/by-name"; | ||
| attr_path_regex = "^(tcl\\d*Packages)\\..*$"; | ||
| unversioned_attr_prefix = "tclPackages"; | ||
| all_packages_path = "/pkgs/top-level/tcl-packages.nix"; | ||
| } | ||
| { | ||
| id = "main"; | ||
| path = "pkgs/by-name"; | ||
| attr_path_regex = "^[^\\.]*$"; | ||
| unversioned_attr_prefix = ""; | ||
| all_packages_path = "/pkgs/top-level/all-packages.nix"; | ||
| aliases_path = "/pkgs/top-level/aliases.nix"; | ||
| } | ||
| ]; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
The biggest issue with how it's done currently closely relates to this here. As far as I understand, the new
eval.nix/eval.rsdoes a recursive Nixpkgs evaluation, lists all resulting attribute paths and then checks which ones match the regex defined here.This complicates the
eval.nixbecause it needs to handle all the random failing evaluations in Nixpkgs, making it very brittle and slow.Instead, please change this configuration options to be like suggested in #31:
Notably we don't need to check all the different version sets like
python311Packages, etc., because the only reason we need to evaluate anything at all is for the eval-time checks and ratchet checks. Since all thepython3*Packagessets only differ in very minor ways, checking one of them is good enough. This will be much more efficient and simplify the code a lot.On the implementation side, the code then only needs to evaluate the attributes directly under that attribute path, just like the
eval.nixin the main branch (I'm afraid a lot of youreval.nixchanges won't be needed 😅) . I also recommend changing whateval.nixoutputs to be more suited to the new functionality, e.g. something likeThis should make the diff to what it was fairly small.