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

[wip] create categories.nix #325357

Closed
wants to merge 9 commits into from
Closed

[wip] create categories.nix #325357

wants to merge 9 commits into from

Conversation

AndersonTorres
Copy link
Member

@AndersonTorres AndersonTorres commented Jul 7, 2024

Description of changes

Restarting #230439

POC of NixOS/rfcs#146

Edit

For those interested in commenting this PR: I am not planning to merge it as-is.
It was/is a mere proof of concept, useful for discussions, given that I believe some discussions are better substantiated by code.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@github-actions github-actions bot added 8.has: documentation This PR adds or changes documentation 6.topic: stdenv Standard environment 6.topic: lib The Nixpkgs function library labels Jul 7, 2024
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 labels Jul 7, 2024
@AndersonTorres AndersonTorres changed the title [wip] create maintainers/categories-set.nix [wip] create categories-set.nix Jul 8, 2024
@fgaz fgaz self-requested a review July 8, 2024 07:35
{ lib }:

let
mainCategories = {
Copy link
Member

Choose a reason for hiding this comment

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

Don't you think this list is way, way to long to start with?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is just the Appstream listing.

https://www.freedesktop.org/software/appstream/docs/

Copy link
Contributor

Choose a reason for hiding this comment

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

was this generated via script, then?

Copy link
Member Author

Choose a reason for hiding this comment

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

Nope, it was generated by Emacs keyboard macros! :)

Comment on lines +499 to +510
instantMessaging = {
name = "instantMessaging";
description = ''
'';
relatedCategories = [];
};
ircClient = {
name = "ircClient";
description = ''
'';
relatedCategories = [];
};
Copy link
Member

Choose a reason for hiding this comment

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

Also I question the usefulness of copying the entirety of xdg. For example those two are just chat.

Copy link
Member Author

Choose a reason for hiding this comment

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

Along the conversations of RFC 146, it was cited the integration with Appstream.

'';
relatedCategories = [];
};
java = {
Copy link
Member

Choose a reason for hiding this comment

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

or why java? Do we then also need rust, go, ruby, etc? Collecting such detailed metadata is not making this effort easier.

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe it was from a time Java applets were very typical. And, we know, backwards compatibility...

description = ''
Description of category
'';
relatedCategories = [ related01 related02 . . . ];
Copy link
Member

Choose a reason for hiding this comment

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

I think this representation of category relations is too ambiguous. Do I add parent categories here? Children? Siblings? An example would be helpful.

Categories naturally have a forest shape. As I proposed in NixOS/rfcs#146 (comment) I think we can represent relations as parentCategory = cat1, then we can flatten the relations as needed in a post-processing step.

parentCategories = [ cat1 cat2 ] (plural) would also work, but I think we can restrict ourselves to a singular parent since packages can have multiple categories.

Alternatively, I propose to omit relations until we have a clearer picture of how categories are used.

Copy link
Member

Choose a reason for hiding this comment

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

I think these will be parent categories, in the end; it might end up being a DAG not a forest.

I agree, though, that cutting the not-strictly-necessary stuff at first is often good, and adding the relation records will not become harder with time.

{ lib }:

let
mainCategories = {
Copy link
Member

Choose a reason for hiding this comment

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

I think we can remove the mainCategories/additionalCategories distinction, especially if we establish a hierarchy as described in https://github.com/NixOS/nixpkgs/pull/325357/files#r1668350336. Furthermore, RFC146 (section "Semantic Details") establishes "most important" categories to be a package-level concept.

Copy link
Member Author

Choose a reason for hiding this comment

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

The intention is not to establish a hierarchy, but to reflect Appstream.

Copy link
Member

Choose a reason for hiding this comment

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

A priori, for automatic conversion one doesn't need all FreeDesktop.org categories to have different images…

Copy link
Contributor

Choose a reason for hiding this comment

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

"images"?

Copy link
Member

Choose a reason for hiding this comment

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

In the sense of a function mapping preimages to images. Automatically deciding something based on FreeDesktop.org categories might be useful even we decide the same thing for specific different 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.

Image in the sense of mathematical functions? "We do not need a bijective mapping between Appstream and Nix Categories"?

Copy link
Member

Choose a reason for hiding this comment

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

Yes.

We cannot have a surjective mapping (which would mean no non-FreeDesktop.org-matching categories) because Appstream is about apps and we have some very non-apps packages (and Freedesktop.org categorisation is for application launchers even before Appstream).

We are not obliged to have an injective mapping either, as some distinctions can be ignored or not ignored as a policy decision.

@AndersonTorres AndersonTorres changed the title [wip] create categories-set.nix [wip] create categories.nix Jul 8, 2024
@afh afh mentioned this pull request Jul 10, 2024
13 tasks
@7c6f434c
Copy link
Member

I think the actual category set will get merged as maintained by the categorisation team; maybe the team can be added separately first, though.

@AndersonTorres
Copy link
Member Author

I believe this PR accomplished its intent of bringing a proof-of-concept. So I will close this.

@AndersonTorres AndersonTorres deleted the rfc146-meta-categories branch July 26, 2024 17:39
@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/16

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: lib The Nixpkgs function library 6.topic: stdenv Standard environment 8.has: documentation This PR adds or changes documentation 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants