-
-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Implement check to disallow pkgs/by-name
package definitions in all-packages.nix
with an empty argument
#256792
Conversation
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/2023-10-03-nixpkgs-architecture-team-meeting-44/33798/1 |
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
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would have said this is premature and not needed yet, but that should not block this if we already can use it.
Description of changes
This PR extends the
nixpkgs-check-by-name
tool to allow checking that packages inpkgs/by-name
cannot also have a definition inall-package.nix
with 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/foo
exists, this would be disallowed inall-packages.nix
:because the second
callPackage
argument 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
_internalCallByNamePackageFile
that is necessary to perform this check