Skip to content
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

Merged
merged 39 commits into from
Jul 8, 2024

Conversation

AndersonTorres
Copy link
Member

This RFC proposes a new meta.categories attribute in order to categorize Nix packages, instead of using the filesystem dirtree.

Rendered!

@AndersonTorres AndersonTorres changed the title Meta.Categories, not Filesystem Diretory Trees [RFC 0146] Meta.Categories, not Filesystem Diretory Trees Apr 23, 2023
@AndersonTorres
Copy link
Member Author

AndersonTorres commented Apr 23, 2023

The idea of this RFC was triggered by the RFC #140, by the way.

Ref.: #140 (comment)

@PetarKirov
Copy link

PetarKirov commented Apr 23, 2023

One of the advantages of meta.categories, not directly mentioned in the RFC (though could be thought of as a consequence of solving drawback 7) is that users will be able to browse for packages in search.nixos.org (and similar tools based meta) much more easily. Currently the file system hierarchy is only visible for people browsing the nixpkgs repo, while being a hidden implementation detail for all other users.

Nonetheless, other good software collections do this just fine, and we can
easily imitate them. Indeed, we can follow/take a peek at how Repology keeps
the categorizations defined by those software collections.

Copy link
Member

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.

Copy link
Member

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

Copy link
Member Author

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.

Copy link
Member

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:

  • listing an uncurated set of categories does not appear to be useful
    • curating and restricting are different ideas!
  • some categories highlight library ecosystems (e.g. the Scotty category) - this could alternatively be captured by a related packages attribute (presumably out of scope, but worth considering)
  • we might want to embed these categories into ours - if we go with some open categories

Copy link
Member Author

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

@AndersonTorres AndersonTorres changed the title [RFC 0146] Meta.Categories, not Filesystem Diretory Trees [RFC 0146] Meta.Categories, not Filesystem Directory Trees Apr 23, 2023
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome.

Comment on lines +176 to +178
2. Bikeshedding

How many and which categories we should create? Can we expand them later?
Copy link

@ghost ghost May 5, 2023

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.

```

# Drawbacks
[drawbacks]: #drawbacks
Copy link

@bew bew May 6, 2023

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 packages categories 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:

{
  meta.categories_lookup = { compiler = lib.categories.compiler; . . . };
}

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):

{
  meta.categories = { inherit (lib.categories) compiler; . . . };
}

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?

Copy link
Member Author

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:

{
. . .
  meta = {
    maintainers = [ maintainers.MeMyselfAndI ];
    categories = { inherit (lib.categories) compiler; }
  };
. . .
}

Why maintainers is a list while categories is a strange dictionary?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why maintainers is a list while categories is a strange dictionary?

That can be solved by migrating maintainers list to a dictionary.

Copy link
Member Author

@AndersonTorres AndersonTorres May 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And meta.platfoms too?

nix-repl> :l <nixpkgs>
Added 16546 variables.

nix-repl> pkgs.bochs.meta.platforms
[ "i686-cygwin" "x86_64-cygwin" "x86_64-darwin" "i686-darwin" "aarch64-darwin" "armv7a-darwin" "i686-freebsd" "x86_64-freebsd" "x86_64-solaris" "aarch64-linux" "armv5tel-linux" "armv6l-linux" "armv7a-linux" "armv7l-linux" "i686-linux" "m68k-linux" "mipsel-linux" "mips64el-linux" "powerpc64-linux" "powerpc64le-linux" "riscv32-linux" "riscv64-linux" "s390-linux" "s390x-linux" "x86_64-linux" "aarch64-netbsd" "armv6l-netbsd" "armv7a-netbsd" "armv7l-netbsd" "i686-netbsd" "m68k-netbsd" "mipsel-netbsd" "powerpc-netbsd" "riscv32-netbsd" "riscv64-netbsd" "x86_64-netbsd" "i686-openbsd" "x86_64-openbsd" "x86_64-redox" ]

nix-repl> 

Copy link
Member

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

@piegamesde
Copy link
Member

The idea of this RFC was triggered by the RFC #140, by the way.

I'd like to have a section in this RFC discussing its relationship and synergies with RFC 140. Does one of them depend on the other? Or are they completely orthogonal to each other?

@AndersonTorres
Copy link
Member Author

Completely orthogonal.

Certainly if this RFC solves a corner problem of that other #140 (losing the classification), but they have no dependencies.
This RFC merely decouples the classification from the filesystem.

@suhr
Copy link

suhr commented May 7, 2023

For initial categorization one could extract categories from current package paths. So for example applications/editors/emacs get meta.categories = [application editor];

backward references.
- Especially in some auxiliary tools like editor plugins, testing suites,
autoupdate scripts and so on.
- Rewriting `all-packages.nix` can be error-prone (even using Metapad) and it

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 like python3, 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.

rfcs/0146-meta-categories.md Show resolved Hide resolved
rfcs/0146-meta-categories.md Show resolved Hide resolved
@AndersonTorres
Copy link
Member Author

For initial categorization one could extract categories from current package paths.

For now I have made a preliminary code‚ copying the Freedesktop.org menu entries. It is already in the PR queue for Nixpkgs acceptance.

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/rfcsc-meeting-2024-06-24/47589/1

@AndersonTorres
Copy link
Member Author

@fgaz @natsukium friendly ping

Copy link
Member

@fgaz fgaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the latest changes (in particular the creation of a categorization team) align with the discussion above. I agree with starting FCP.

Copy link
Member

@natsukium natsukium left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I apologize for suspending this RFC.
I think we are ready to take the next step.

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/rfc-0146-fcp-meta-categories/47818/1

@7c6f434c
Copy link
Member

So we are starting the Final Comment Period with disposition to accept, running until 2024-07-08

Discourse announcement: https://discourse.nixos.org/t/rfc-0146-fcp-meta-categories/47818

We are also now looking for volunteers for the category list maintenance team!

@tomodachi94
Copy link
Member

tomodachi94 commented Jun 28, 2024

I volunteer to be part of the Categorization Team. I have a strong background in ontology from my work on Wikidata, so I feel that I could meaningfully contribute here.

(This is the correct spot, right? 🙂)

@jopejoe1
Copy link
Member

Would be intressted in joing the catagory maintenance team.

@Aleksanaa
Copy link
Member

Would be intressted in joing the catagory maintenance team.

Me too.

@7c6f434c
Copy link
Member

7c6f434c commented Jul 7, 2024

Re: team — @GetPsyched over at Discourse https://discourse.nixos.org/t/rfc-0146-fcp-meta-categories/47818/2 (as the majority of team joining interest comments are here, I make a reference not to forget)

@GetPsyched
Copy link
Member

Apologies, I didn't want to create more noise on the RFC itself; however since we're nearing a merge soon, I guess this is fine.

@7c6f434c
Copy link
Member

7c6f434c commented Jul 7, 2024

What you did is perfectly good, but my duty as a shepherd leader is to keep the situation easier to summarise!

(And yeah, we don't have and don't expect much else going here right now)

@GetPsyched
Copy link
Member

RFCSC:

@7c6f434c, the FCP period has passed, can you confirm if this RFC is good to be merged?

@GetPsyched GetPsyched added status: FCP in Final Comment Period and removed status: in discussion labels Jul 8, 2024
@7c6f434c
Copy link
Member

7c6f434c commented Jul 8, 2024

Yes, I think there have been no blocking objections (and some local criticisms have been addressed acceptably)

@GetPsyched GetPsyched merged commit 62d1245 into NixOS:master Jul 8, 2024
@GetPsyched GetPsyched added status: accepted and removed status: FCP in Final Comment Period labels Jul 8, 2024
@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/rfcsc-meeting-2024-07-08/48678/1

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/tagging-categorising-nixpkgs/55396/3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.