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

pkgs/by-name: recommendations for multi-versioned packages #292214

Merged
merged 1 commit into from
Mar 1, 2024

Conversation

infinisil
Copy link
Member

@infinisil infinisil commented Feb 29, 2024

Description of changes

Over the past weeks, we've seen one oversight with the new enforcement of pkgs/by-name for new packages.

This documents the problem and the recommendation for resolving it.

Here's some PRs that could've benefited from this:

In the future, the error message should also link to this documentation

Ping @AndersonTorres @afh

This work is sponsored by Antithesis


Add a 👍 reaction to pull requests you find important.

@delroth delroth added the 12.approvals: 1 This PR was reviewed and approved by one reputable person label Feb 29, 2024
@AndersonTorres
Copy link
Member

Not directly related, but a thing that concerns me is that darwin. apple_xyz_sdk.callPackage that hinders by-name adoption, e.g. for tinycc.

@infinisil
Copy link
Member Author

@AndersonTorres Quick thoughts: I like how pkgs/by-name highlights such oddities and urges us to resolve them. While I think it's totally possible to fix that, I don't have an immediate answer.

This seems like an orthogonal problem though, could you open an issue for this?

@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux labels Feb 29, 2024
@adamcstephens
Copy link
Contributor

There are a lot of options in here, but it's not clear to me on first read which I'd want. Is there no way to loosen the checks somehow for packages that have yet to migrate?

@infinisil
Copy link
Member Author

There are a lot of options in here, but it's not clear to me on first read which I'd want.

I do think the first one is the best general recommendation, maybe that should be highlighted more. The others are really just further refactorings that could optionally be done, which at that point don't actually have much to do with pkgs/by-name anymore. I don't think any of those refactorings is strictly superior either.

Is there no way to loosen the checks somehow for packages that have yet to migrate?

I'm fairly undecided about this, but that is indeed a possibility. It will even be fairly easy once the automated migration is implemented (in code), because that needs to check the very same property: It can only migrate packages that don't share any files with other packages.

Copy link
Member

@afh afh left a comment

Choose a reason for hiding this comment

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

Thanks for writing this up, @infinisil. Very helpful!

Especially the list of example PRs where this popped up. I'd like to suggest to include #289690 in said list.

See below a minor blank space suggestion for consistency if this is relevant/important for project READMEs.

pkgs/by-name/README.md Outdated Show resolved Hide resolved
@delroth delroth added 12.approvals: 2 This PR was reviewed and approved by two reputable people and removed 12.approvals: 1 This PR was reviewed and approved by one reputable person labels Feb 29, 2024
Over the past weeks, we've seen one oversight with the new
enforcement of `pkgs/by-name` for new packages.

This documents the problem and the recommendation for resolving it.
@infinisil infinisil force-pushed the by-name-multi-version-docs branch from ebba600 to 8032bb6 Compare March 1, 2024 01:58
@infinisil
Copy link
Member Author

@afh Thanks, done that!

@delroth delroth removed the 12.approvals: 2 This PR was reviewed and approved by two reputable people label Mar 1, 2024
amarshall added a commit to amarshall/nixpkgs that referenced this pull request Mar 1, 2024
infinisil added a commit to tweag/nixpkgs that referenced this pull request Mar 1, 2024
The `pkgs/by-name` check currently fails on the staging-next merge into
master (https://github.com/NixOS/nixpkgs/actions/runs/8110296543/job/22167262748)
because it contains the changes of NixOS#278920, which introduced a "new" package using `callPackage` but not using `pkgs/by-name`.

This was never noticed in that PR because CI last ran almosts 2 months ago, which is before the check for new packages was introduced.

This wouldn't be a problem normally, it's only become a problem because
of the staging-next merge into master, which effectively PRs the same
change again (and the `pkgs/by-name` check doesn't try to distinguish
between branches).

The fix for this is a bit special because it's not actually a "new"
package, but rather just a new version of an existing package. The
`pkgs/by-name` check can't distinguish between such cases though.

So instead we make sure that the `pkgs/by-name` check doesn't think of
it as a package using `callPackage` by using the recommendation for
multi-versioned packages from
NixOS#292214.
@infinisil infinisil merged commit 0e619d7 into NixOS:master Mar 1, 2024
18 checks passed
@infinisil infinisil deleted the by-name-multi-version-docs branch March 1, 2024 22:46
@nixos-discourse
Copy link

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

https://discourse.nixos.org/t/how-to-deal-with-two-versions-of-a-package-in-by-name/40841/2

@nixos-discourse
Copy link

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

https://discourse.nixos.org/t/how-to-deal-with-two-versions-of-a-package-in-by-name/40841/5

@nixos-discourse
Copy link

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

https://discourse.nixos.org/t/how-to-deal-with-customized-callpackage-in-that-new-by-name-era/41081/1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants