-
-
Notifications
You must be signed in to change notification settings - Fork 15k
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
A function to compose overlays? #33258
Comments
It seems to be fine. With it, you can do even nested overlays that work as expected (and definition sites need not—and should not—know about the nesting): It’s not super convenient, but at least it’s something. ¯\_(ツ)_/¯ |
About the name: this is not only useful to compose overlays, but also Haskell, Qt, and Emacs package sets. (All three use the |
@volth, the comment says of two only? And to my eye, the implementation confirms that: Lines 46 to 53 in 0ea0e3c
|
Reopening because I think such function should be added to |
@FRidh thank you! |
@volth, would it be very terrible to add your definition under the name of |
Eh, from the standpoint of "provide the simplest building blocks to be composed as needed by users" there's a lot of precedent (in other functional languages, math, etc.) for just providing the two-argument version and letting people fold the two together. Here's a concept I like in this space:
|
@volth, emm, is the sum/product example an argument for or against? Other fine libraries do define them: https://hackage.haskell.org/package/base-4.10.1.0/docs/Data-Foldable.html#v:sum @copumpkin, if this is not needed in general, fine. I can define it myself, no problem. However, intuitively (but my intuition in Nixpkgs is very lacking!), I would say that from an OS declaration standpoint, I’d be much more likely to use the list version rather than the pair version. If you could quickly, in 1-2 sentences, discuss why the pair version is more useful in general, I’d love to read that! |
👎 on adding a function that's just a trivial fold over |
@peti @copumpkin @volth, why is there Adding documentation is probably even more work than adding the function. But, I guess, the real question is why that |
Or maybe! I’d like to propose that we add my trivial fold and remove this silliness, in line with your argumentation, if I get it right: Lines 80 to 94 in bdb2985
Net, we’d all win. 😀 |
I agree, although I would like to note that this is Nixpkgs, not Nix. Here we have a wider audience to consider.
In my opinion overlays is a fundamental concept of how we (want to) do package sets in Nixpkgs, and therefore I think it should become trivial to merge extensions using a single function, just as most languages offer a sum or product function for their fundamental building blocks: integers and floats. Now that we recommend using overlays in various places throughout Nixpkgs, I don't think users should need to know or learn how to use a higher-order function like |
+1 |
Is http://hackage.haskell.org/package/containers-0.5.11.0/docs/Data-Set.html#g:5 |
This comment has been minimized.
This comment has been minimized.
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/infinite-recursion-when-composing-overlays/7594/1 |
Common idioms form a domain specific language. If people keep independently rediscovering and implementing their own helper functions (as linked above), that should be obvious and definitive evidence of the need for a library function. I think someone comfortable with it just needs to make the PR and get it merged. :) |
The proposed function was sneaked in with #103061. I don't like the name however. |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/namespacing-scoping-a-group-of-packages/13782/10 |
Wouldn’t it be useful to have a function in
lib
to compose overlays? It’s short to define, but perhaps non-trivial (given we have no types in Nix — nb., I’m not sure if my definition is really correct):It would also be more in line with what is promised in these slides: https://nbp.github.io/slides/NixCon/2017.NixpkgsOverlays/ (→ slide 25).
This way the user can define expression files that themselves are valid overlays (not lists of overlays) and which themselves comprise of other valid overlays.
I.e. the user can compose the overlays…
The text was updated successfully, but these errors were encountered: