-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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
Unify pkg.override and drv.overrideAttrs #295039
Comments
This was one I've been working on a lot. These are used for my Node.js routines that dynamically generate derivations from various types of Node.js metadata ( EDIT: I just realized I meant to post this in the other issue: "inconsistent override mechanisms". I can't delete this comment for whatever reason though. |
Very related to #295046 |
@DavHau and I have found an interesting solution to implement this in the experimental Here you can see it in action: the This avoids the function indirection, which would be hard to override, and it allows everything about the package, including the default dependencies, to be declared in the same file. |
PoC alternate simple module implementation (as this issue usually comes up in modular package discussion): |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/2023-02-30-nixpkgs-architecture-team-meeting-30/25973/1 |
I think there may be some problems, but perhaps some of them will cease to exist before they are encountered. Enough people seem to be getting frustrated with splicing that there is talk of providing a much simpler alternative and seeing if people are willing to switch. Some of those alternatives fit very nicely with the "let Footnotes |
dream2nix has a |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: |
Issue description
Noting that
.override
after.overrideAttrs
)we can reduce the package definition to a single fixpoint and single overriding mechanism.
Goal
This issue is done when
.override
has become unnecessary.Example
A package definition currently looks as follows.
Instead it could look like
which can be reduced with function reflection "syntax sugar" to:
and have its boilerplate DRY-ed into a function that is used similarly to
callPackage
today to becomeAlternatives
Another way to approach this is to merge
callPackage
andmkPackage
into one function, and possibly reducemkDerivation
to a function we generally don't override.Notes
Note that this also resolves the problem of dependency choices having to be specified in
all-packages.nix
. Refs #295042mkDerivation
does not support local variables yet. This touches on the idea of amkPackage
function that leaves the actual derivation stuff up to its caller. Refs #295044Open question: how does cross compilation splicing fit into this picture?
The text was updated successfully, but these errors were encountered: