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

Package set standardization #295031

Open
tomberek opened this issue Aug 4, 2023 · 4 comments
Open

Package set standardization #295031

tomberek opened this issue Aug 4, 2023 · 4 comments
Labels
6.topic: architecture Relating to code and API architecture of Nixpkgs

Comments

@tomberek
Copy link
Contributor

tomberek commented Aug 4, 2023

Package Set Standardization

Ensure the package sets in Nixpkgs use a common interface and implementation.

Problem

Package sets are a concept used in Nixpkgs, but not often documented and explained. This is the mechanism that is used to create a scope (https://github.com/NixOS/nixpkgs/blob/master/lib/customisation.nix) and supports the callPackage design pattern. There are a few of these in Nixpkgs, top-level, pythonPackages, perlPackages, etc. Any attempt to manipulate these in a common manner runs into issue where they concept is used/implemented/exposed in a slightly different way. Eg perlPackages and phpPackages are constructed differently:
https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/php-packages.nix
https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/perl-packages.nix
Another place of complexity is pythonPackages.

Many of the package sets do seem to follow a common pattern:
https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/octave-packages.nix#L24
https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/qt6-packages.nix#L13

Consequences

The mechanism is often discussed and confused with overlays.
The mechanism can be confusing, but also helpful: https://summer.nixos.org/blog/callpackage-a-tool-for-the-lazy/

Tooling to manage and manipulate these package sets become more awkward.

Potential issues

Cross-compilation and makeScopeWithSplicing are more complex: https://github.com/NixOS/nixpkgs/blob/master/lib/customisation.nix#L282
Picking an implementation that can accommodate the various needs. (what are they?)
Duplicate of https://github.com/nixpkgs-architecture/issues/issues/1 ?

@infinisil
Copy link
Member

I recently had the chance to think about how I'd design a new package set: #235614. Afaik the only thing missing is cross compilation support.

I think we can treat this as separate from #295046 because this can be much smaller in scope. We can still have various override mechanism, but at least they'd be consistent between package sets.

@nixos-discourse
Copy link

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

https://discourse.nixos.org/t/2023-08-08-nixpkgs-architecture-team-meeting-42/31454/1

@Artturin
Copy link
Member

Artturin commented Aug 8, 2023

x.pkgs is bad because package sets within derivations are not spliced
#211340

#211340 (comment)

I think about 8 years ago I introduced this and it has been a clear mistake. Since then this pattern was copied throughout. We should indeed go to pythonPackages and also move the helpers such as buildEnv and withPackages into the package set

@nixos-discourse
Copy link

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

https://discourse.nixos.org/t/2023-11-28-nixpkgs-architecture-team-meeting-46/36171/1

@infinisil infinisil transferred this issue from nixpkgs-architecture/issues Mar 11, 2024
@infinisil infinisil added the 6.topic: architecture Relating to code and API architecture of Nixpkgs label Mar 11, 2024
@t4ccer t4ccer mentioned this issue Mar 26, 2024
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: architecture Relating to code and API architecture of Nixpkgs
Projects
None yet
Development

No branches or pull requests

4 participants