-
Notifications
You must be signed in to change notification settings - Fork 1
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
[0003] Align file paths to the exposed attrs #3
Open
jonringer
wants to merge
1
commit into
master
Choose a base branch
from
normalize-attr-file-paths
base: master
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.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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,48 @@ | ||
--- | ||
Title: Align file paths to the exposed attrs | ||
Author: jonringer | ||
Discussions-To: | ||
Status: Draft | ||
Type: Standards Track | ||
Repo: All poly repos | ||
Topic: Packaging | ||
Created: 2024-10-06 | ||
--- | ||
|
||
# Summary | ||
|
||
Nixpkgs contains a lot of legacy "oddities" which cause some impediance mismatch | ||
when currating a large package set. One of these "oddities" is that is fairly | ||
common for packages to not align the expected file path. This proposal wants | ||
to enforce that the "way a package is consumed should reflect where it is placed. | ||
|
||
Normalizing names and file paths align nicely with [auto-called-directories](https://github.com/jonringer/nix-lib/commit/86961f6f0139a70ee29a74237dd59a9936299ed0) | ||
which eliminates the need for an explicit attr to reference the file or directory. | ||
|
||
## Detailed Implementation | ||
|
||
There's four scenarios which in particular which should be addressed: | ||
- Attrs referencing a wrapper or specific version. E.g. `gobjection-introspection` points to a wrapper.nix | ||
- Instead, the default attr should point to `default.nix` and the `-unwrapped` variant should point to an `unwrapped.nix` | ||
- File locations should be consolidated in a way to reflect the package scope in which they are contained | ||
- E.g. `attr: pkgs.expat` -> `file: pkgs/expat/default.nix` | ||
- E.g. `attr: python.pkgs.pip` -> `file: python/pkgs/pip/default.nix` | ||
- Directory name should directly correspond with attr | ||
- E.g. `gtk/3.x.nix` should be `gtk3/default.nix` | ||
- Passing overrides to `callPackage` should be discouraged, instead the specific attr should be referenced by the nix expression | ||
- E.g. Listing `ffmpeg` in the nix expression, but passing `ffmpeg = ffmpeg_7;` in the overrides, it should just be `ffmpeg_7` in the nix expression | ||
|
||
## Adjacent efforts | ||
|
||
- [PolyPkg proposal](https://github.com/jonringer/multiple-package-versions-proposal) mitigates the "which variant do I need?"/overrides issue. | ||
- E.g. `ffmpeg` can be passed to the nix expression, but `ffmpeg.v7` can be passed as an input, which eliminates the need to pollute a package scope with many varaints | ||
|
||
## Future work | ||
|
||
- Do the work | ||
|
||
## Meta concerns | ||
|
||
- Collapsing the folders could result in absurdly large directories | ||
- This is somewhat mitigated by the poly-repo structure. There should only be a few thousand packages in any one directory in a given repo. | ||
|
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.
If performance should ever become a primary concern, I submit to solve it eventually via code generation, in any case other means: maintaining the origin source optimized for readability as this EEP pursues.