-
-
Notifications
You must be signed in to change notification settings - Fork 13.7k
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: document toplevel argument restrictions #325262
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,6 +76,17 @@ and override its value in [`pkgs/top-level/all-packages.nix`](../top-level/all-p | |
} | ||
``` | ||
|
||
### Toplevel argument restrictions | ||
The list of toplevel arguments should be restricted to packages defined in the | ||
common nixpkgs package set, and simple `enable*` boolean flags. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Attributes of type string are employed to indicate options. Emacs expression accepts And Emacs is outside |
||
|
||
As the expression is being `callPackage`'ed, both newly-defined packages, as | ||
well as those added through the use of overlays will cause defaults to be | ||
overwritten in a unexpected and hard-to-debug fashion. | ||
|
||
In case you're intending to write more flexible package expressions, consider | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed it's not This also say it's because it's callPackage'd. I still think it's worth to write it down like this, because people tend to be too fancy with what they do in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The main restriction with by-name is that you can't use a custom callPackage, there's nothing else that I know of affecting the override interface. Besides, there is an upcoming check to enforce moving to by-name when touching packages at the top-level, so this suggestion doesn't make sense. Let's just drop the sentence and make the guidelines more explicit if needed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please propose exact wording in a new PR. |
||
defining them outside `by-name`. | ||
|
||
## Manual migration guidelines | ||
|
||
Most packages are still defined in `all-packages.nix` and the [category hierarchy](../README.md#category-hierarchy). | ||
|
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.
Well, technically nothing hinders someone of creating a package with the exact same name of a Boolean flag.
What about with-shell?
https://github.com/NixOS/nixpkgs/blob/nixos-24.05/pkgs/applications/misc/with-shell/default.nix
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.
Doesn't have any "non-package args", so don't understand the question.
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 am saying that
with-shell
is an existing package, and because ofcallPackage
no one can usewith-shell
as a simple Boolean flag.