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.
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
[RFC 0146] Meta.Categories, not Filesystem Directory Trees #146
[RFC 0146] Meta.Categories, not Filesystem Directory Trees #146
Changes from 35 commits
610c110
415c97a
a908922
f2eac8d
5444d90
93ef176
2bf1c25
e29a413
79b92e9
004fc01
6289abe
602e521
fd1d6af
c30ff6c
907d510
4d02382
0a868c6
e258926
98a8348
cc8caa3
618dc67
abbf7fd
0e21673
21ec340
a18c24a
f771094
eb079f6
0ad89e7
fa75eec
ee8633c
2dcb0ed
e0ee96f
a029a22
172cc8e
fdc2424
11a7757
bcc2444
9979bef
f643103
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Also,
all-packages.nix
is HUGE. 40306 lines on the master at the time of me writing this comment. No person can ever go through that manually, which means that one would have to use file searching functionality (which is very inconvenient for stuff likepython3
, which is often also an argument to a lot of other packages, and very error-prone because sometimes stuff has weird names). It also takes a while to load and parse.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.
Idk, this might be a bit off topic, but one use case this RFC would enable is to have something like
nix-shell -p
but for launcher like rofi, dmenu, etc... because I would imagine that there would be a tag for graphical applications and then one can filter for those and dynamically use nix to load them like one would with a nix-shell.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.
I am not sure how to word such a use case carefully, given that many packages contain multiple GUI applications that can be launched without arguments, and then some more programs where command-line arguments are expected.
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.
To me it looks like an extra application that uses the Nixpkgs metadata as a filter. Something like
nix-index
with extras as a backend for a launcher.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.
What about ease/speed of finding all packages of a specific category or a set of categories ?
I mean: by using a list of categories it means that to find all
compiler
packages we would have to go through every packagescategories
list, and compare every elements of that list.There is no fast hash lookup like
meta.categories.compiler
.(not 100% sure about it) One way to make single category lookup fast could be to generate a lookup attrset like:
Another way could be to NOT use a list of categories in the first place and directly use an attrset like that one above. And get the added benerit of inherit to easily write it (avoiding one more usage of
with x; y
):The only downside I see is that we loose the ordering of categories (not mentioned yet, but the first one could mark the pkg's primary category) on the other hand it removes a bikeshed waiting to happen (how to order categories).
I don't think ordering is that important though, and if we want to mark the primary category of a pkg there are other ways, like using a special category name
meta.categories.primary = lib.categories.foobar
.To check if a package has a set of categories I don't think there's a better way than to check if the pkg is in the first category, then the second, etc..
What do you think?
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.
Hum, the problem I can see is that it would be not orthogonal. Look:
Why maintainers is a list while categories is a strange dictionary?
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.
That can be solved by migrating maintainers list to a dictionary.
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
meta.platfoms
too?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.
One could switch meta to attrubute sets, but currently it's all lists, yeah, so makes sense to follow this tradition
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.
Allowing to add, remove, or split categories would mean that any bikeshedding wouldn't block other processes, which is a good thing.
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.
Another alternative might be an open taxonomy.
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.
+1. It would allow us to import the existing categories as they are, and thanks to nix we can map them to freedesktop categories in the category definition, like the current license-spdx mapping
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.
Well, I believe I can produce some preliminar code on this regard.
Basically I can verbatim copy-paste the categories of Freedesktop, just for start.
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.
Here's a largely uncontrolled categorization, although skewed by a built in scaffolding tool that only suggests some 20 categories: Haskell packages by category
My takeaways:
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.
I have proposed something like "related categories" on the preliminary code:
NixOS/nixpkgs#230439