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 16 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
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 is imo the most important thing, a categorization is useless if it isn't curated. Unfortunately this is really not trivial, because both the set of packages and categories are really large, any package could be in any category, and both of them change over time.
So I would like to see some automated process for this, here's an idea for a very fancy one:
I have a feeling that a Nixpkgs-specific website would be great to integrate this all together, along with E-Mails for notifications. Maybe this could be combined into e.g. a maximum once-per-week E-Mail, asking package maintainers to perform necessary actions to maintain their packages, which could also include things like reviewing relevant PR's or issues, tending to Hydra build failures, etc.
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.
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 think we shouldn't reinvent the wheel and work as much as possible with existing categorization data. For example, many applications have desktop files whose categories (and tags) one could use. And maybe repology has something useful 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.
This should not be too hard.
The not-so-good parts are to convert from filesystem classification
misc
(andapplications/misc
)applications
andtools
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 guess that is a benefit of having to decide on exactly one category for a package: Either you'll find the most accurate category, or none of them apply which justifies creating a new one. Therefore there is no general category maintenance required, it happens naturally as packages get added.
We should consider this as an alternative, something like
And if we want to be more specific we could have category and subcategory, or something like that
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 feel this is not good, because it would defeat the cases of multi-valued categorization.
What about mail server, game server, file server...? One category for each looks too much.
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.
Yeah I agree it's not perfect, but if I had to choose between a curated single-valued categorization and an uncurated multi-valued one, I think I'd pick the former.
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.
At least the multi-valued version can include all that others (including upstreams, if they provide some of the many categorisation labels) think too. Agreeing on the layout of anything single-valued will go as well as any attempt to globally agree on anything in Nixpkgs, it will be a weird and inconvenient to all (but in different ways, of course) compromise.
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.
An uncurated multi-valued can possibly be curated in a mostly independent fashion - curating does not block a package's inclusion.
On the other hand, seeking the most fitting one-valued category puts a non-negligible mental load for each single package.
I aggree it is better the curation than the non-curation, but we have the option of a multi-valued curation.
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 would be nice if categories could be discovered and filtered for PR review using github tags. This would be useful for quickly merging trivial packages like games.
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.
Agree that it would be nice, unsure if it needs spelling out explicitly as a part of «Update CI».
Or maybe some version of this could go into motivation?