It’s not easy to do programmatically: the top-level attributes don’t follow the directories hierarchy. Anyway, I wouldn’t spend too much time on this because those categories are going away soon: see CI will soon enforce `pkgs/by-name` for new packages