-
-
Notifications
You must be signed in to change notification settings - Fork 14.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
WIP lib: Better extensible attrsets #51213
WIP lib: Better extensible attrsets #51213
Conversation
There are no more custom names that need this. Normal `makeExtensible` is fine. This reverts commit e4cd45a.
The definition of `makeExtensible` is about to become more involved, such that we cannot just get it out of one file. As such, we first need to construct a non-overridable version of the library to get it, and then construct the final overridable version of the library.
These automatically compose in overlays, giving us the best of both worlds between nested fixed points and a single outer fixed point.
No, this is a wrong direction for Nix. I don't want to have to explain to users what a "monoidal extension" is. The Nix language (as a DSL) should provide the proper concepts, they should not be provided in a library. Also, I suspect that this will make Nixpkgs evaluation even slower and memory-hungry. |
@edolstra don't miss the forest for the trees :)
|
Also, there's a separate issue that it makes little sense to implement a DSL and try it out in one step: One cannot know a priori if the abstraction works, and changing C++ Nix everytime the abstraction needs tweaking is too slow a debug cycle. Changes like this raise the bar, slowly kneading nixpkgs into shape towards the final DSL. Both the refactoring of existing packages and fleshing out of the DSL can take place incrementally. Only once we've converged on a stable interface that's used by a wide range of package does it make sense to freeze and enshrine it with new syntax. |
I agree with @Ericson2314 about trying to do things incrementally; we're not going to be able to convert all of nixpkgs to the new system at once whenever we do get the language level feature. But @Ericson2314, I would recommend finding more friendly names for this stuff. IMO this has little to do with the term "monoid", because it's not actually abstract over the monoid in use. It'd be like calling |
@Ericson2314 That's what we've been doing for the last few years: we have stuff like the module system as a library feature. Now it's time to do it properly as a language feature. |
@ElvishJerricco no it actually is abstract over all monoids in this implementation, just as we talked about long ago. The user doesn't need to worry about arbitrary monoids, but by the same token it is bad and a sign of the WIP-ness of this PR that they currently use any of the monad-polymorphic stuff. @edolstra Yes, NixOS is ready, but Nixpkgs-the-package-set isn't. The most widely used things in nixpkgs like stdenv and cc-wrapepr are known-bad, and the langauge-specific/nested package stuff is not at all standardized. If your proposal only talked about NixOS, it would be one thing, but as it aims for the unified abstraction for packages and configurations, we have no choice but to first force Nixpkgs-the-package-set into good condition. |
@edolstra @ElvishJerricco and @angerman in particular are doing some cool work with next-gen Haskell infra using the NixOS module system. A wonderful yet realistic sequence of events to me looks like:
|
Are there any updates on this pull request, please? |
Thank you for your contributions.
|
Relevant rfc: NixOS/rfcs#67 |
I marked this as stale due to inactivity. → More info |
Motivation for this change
This is a WIP implementation of something like @edolstra's
{{...}}
recursive attrsets (from older https://gist.github.com/edolstra/29ce9d8ea399b703a7023073b0dbc00d), but with theself
-super
pattern. I'm all for the more ambitious goals (sharing abstractions for nixos/nixpkgs, nocallPackage
, prioritizes or something finer-grained oversuper
sledge-hammer, etc), but fear without incremental steps like this, they won't happen.self
super
is today's semantics for NixpkgscallPackage
, works very well withself.callPackage
in the manner of Haskell package sets.In particular, having both the inner and outer fixed points solves the problems with #44196 and my
injectOverride
alternative:overrideScope
needed as one can just usemakeScope
to bind a localcallPackage
which will be updated automatically by extensible attrset merge.The last commit is an example rushed example of how it simplifies
llvmPackages_5
anddarwin
inner attribute set overriding in the Darwin bootstrapping. Further simplification would come from the unrelated change of having justllvmPackages_*.{tools,libraries}
, rather than that + the legacy smushing of everything inside those alongside.Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)nix path-info -S
before and after)CC @ElvishJerricco