[RFC 140 2a] pkgs/by-name: Enforce for new packages#275539
[RFC 140 2a] pkgs/by-name: Enforce for new packages#275539infinisil merged 6 commits intoNixOS:masterfrom
pkgs/by-name: Enforce for new packages#275539Conversation
c53ec7b to
9d746df
Compare
1c31376 to
41b1926
Compare
|
This PR is now theoretically ready, but since the changes got a bit big, I split off everything not directly related to this PR into #278805, which should be merged first. |
41b1926 to
6ff113c
Compare
pkgs/by-name/README.md
Outdated
There was a problem hiding this comment.
I think it is still better to lead with the positive part. Something like
Packages found in the name-based structure are automatically included, without needing to be added in a file like
all-packages.nix. They must only occur in file if they require overriding the default value of an implicit attribute (see below).
There was a problem hiding this comment.
I changed the wording a little bit, but this is essentially applied now :)
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: |
6ff113c to
6e192d8
Compare
philiptaron
left a comment
There was a problem hiding this comment.
I took a thorough look. The tests are quite clear. Nice work. I don't have any code related comments, just copy-editing. Might also run a RFC101 formatter over these Nix files just for giggles.
There was a problem hiding this comment.
For my notes: pkgs/test/nixpkgs-check-by-name/tests/new-package-non-by-name/expected is the test of this.
There was a problem hiding this comment.
Future ratchets might try to drive this number down, I might imagine.
There was a problem hiding this comment.
Oh yeah, I thought about implementing an eval-successful ratchet, but I think this should be a future PR. Then also it's also not pkgs/by-name-specific anymore and the tool could use a rename.
There was a problem hiding this comment.
One only needs to look at the list of things detected by NixpkgsProblems to realize we've backed ourselves into a damn fine nixpkgs linter framework. 🚀
In a future commit this will be extended
Not that important, but nice. Also adds a nice test case show-casing the two current ratchet checks at once.
This was an oversight in NixOS#275539 not accounted for, which would've failed in CI
|
Now that nixos-unstable contains the latest fixes, here's the final follow-up PR: #281835 which starts enabling the enforcement! |
This was an oversight in NixOS/nixpkgs#275539 not accounted for, which would've failed in CI
Note
An open call for the final review and merge was held on 2024-01-15, see #275539 (comment)
Context
This is part of the effort to implement RFC 140, aka
pkgs/by-name. While previous PRs already enabled users to define packages usingpkgs/by-name, there's still thousands of packages still usingall-packages.nix, and new ones added every day.This PR is part of the RFC 140 migration plan, building on top of #272395 and #274591.
This work is sponsored by Antithesis and Tweag ✨
Changes
This PR prevents new packages using
pkgs.callPackagefrom being defined not inpkgs/by-name. Instead thepkgs/by-namedirectory has to be used instead. This the A-side of Part 2 of the RFC.This doesn't affect packages defined using alternate
callPackage's likelibsForQt5.callPackageorcallPackages, whichpkgs/by-namecannot handle (yet?).Note
The effects of this PR will only be seen once the nixos-unstable channel updates, since its pre-built version of the tooling is used for CI.
Things done
callPackagebut not usingpkgs/by-namethrow an errorpkgs/by-namethrows an errorcallPackagedoesn't give an error.Add a 👍 reaction to pull requests you find important.