Implement check to disallow pkgs/by-name package definitions in all-packages.nix with an empty argument#256792
Merged
infinisil merged 7 commits intoNixOS:masterfrom Oct 12, 2023
Merged
Conversation
1 task
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: |
12 tasks
2b353ef to
7f365a9
Compare
Allows a smaller diff for future changes
Allows detecting whether attributes are overridden in all-packages.nix. In a future commit we'll use this to detect empty arguments being set in all-packages.nix and complain about that.
Only enabled with `--version v1`
7f365a9 to
d3bf613
Compare
pkgs/by-name package definitions in all-packages.nix with an empty argumentpkgs/by-name package definitions in all-packages.nix with an empty argument
Member
Author
|
While there's no current violations of this (I thought there was one, but turns out it was a fake), this is a good exercise for future increases in CI strictness. |
tomberek
approved these changes
Oct 12, 2023
Contributor
tomberek
left a comment
There was a problem hiding this comment.
I would have said this is premature and not needed yet, but that should not block this if we already can use it.
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of changes
This PR extends the
nixpkgs-check-by-nametool to allow checking that packages inpkgs/by-namecannot also have a definition inall-package.nixwith an empty attribute set.In order to allow a smooth CI change, the check is not enabled by default for now. It has to be enabled with
--version v1. I will update CI to use this in a future PR. This PR here only updates the tool to support this new check. This way we sidestep the problem of #256788 for now.Example
If
pkgs/by-name/fo/fooexists, this would be disallowed inall-packages.nix:because the second
callPackageargument is an empty attribute set.RFC relation
This notably is a minor violation of what RFC 140 specifies:
However I don't think there's a good reason this shouldn't be done.
By disallowing empty arguments, we can be sure that new packages that don't need any arguments aren't unnecessarily added to
all-packages.nix.Furthermore, we can ensure that if packages are refactored to not need custom arguments anymore, they get removed from
all-packages.nix, and don't linger around unnecessarily.I asked whether anybody had any problems with this on Matrix and in the last NAT meeting, but there were none.
Things done
_internalCallByNamePackageFilethat is necessary to perform this check