-
-
Notifications
You must be signed in to change notification settings - Fork 15.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
[wip] haskell: add core libraries logic to remove need for global package db #43300
Conversation
How do these changes relate to #43070? |
I think they accomplish the same thing - just in different ways. Both should reduce closure sizes. Pros of this approach:
Cons of this approach:
|
This is currently blocked on an issue that I have been unable to debug:
It looks like it picks up base but not rts? |
@peti Unless we're worried about churn for the builders, I'd love to land #43070 as soon as possible, as it was passing deps before mere conflicts. Then we can do this approach, with the libraries having been listed for us, right after. With NixOS/cabal2nix#358 enabling a new strictDeps PR with far fewer overrides + all libraries coming from separate non-GHC derivations, we should be able to both 1) finish cross support and 2) remove all duplicate args, in less than a week! [I say finish because while it would be nice to e.g. build components, including Setup, separately, there is no burden for correctness forcing us to do so.] |
This is really good work, it will reduce haskell closures significantly for packages dynamically linked. |
Actually, I don’t think that my approach affects closure size in any way. |
I might be missing something, but can’t we just “merge” our two PRs by moving the code from P. S. I wonder if the GHC build system can be told to install those packages straight into the right location instead of us copying them around manually. |
I don’t see how this is an abuse TBH. The GHC build process is structured in such a way that it produces both the compiler and libraries for it to use and, furthermore, it is the only supported way of getting those libraries. What I mean is that some of the boot libraries can be then recompiled, but some of them just cannot be built outside of the ghc compilation process, and, AFAIU, this is exactly the purpose of multiple outputs. What we can do is limit those libraries that go to multiple outputs strictly to those that cannot be built separately. |
@kirelagin I personally don't mind multiple outputs, but I do think it's important that we have it so generic-builder and ghc with generic-builder can find them exactly one way. Whether we do that with multiple outputs, or shim derivations I guess doesn't matter as much on that front as long as GHC-without-libraries has its own output / shim derivation. Put another way, the |
The original use case was for splitting up
(just ghc.out is installed IIRC) |
Well, those multiple outputs are just a technical detail, it is actually a good thing that there is no easy way to discover them. They are intended to be used only as top-level haskell packages set attributes. |
Another concern is that more invasive the procedure gets, The move convenient it is to have two derivations for purpose of debug cycles. Kind of like how we don't wrap gcc when be build it but separately. |
This moves core libraries in Haskell to its own derivations. This is needed to avoid references to the GHC compiler ending up in binaries built by GHC. Instead of referencing GHC directly, these binaries will now link to the copies. Unfortunately, for this to work, we need to know which GHC libraries exist at evaluation time. This requires maintaining a list of the builtin library names & their versions in the GHC compiler’s “libs” attribute. A better way of handling this is needed.
ghc8.2.2 apparently doesn’t like moving rts from its original location. Hopefully this was fixed in ghc 8.6.1.
This may not be needed but it is more consistent with the idea of treating core libraries as ordinary haskell libraries.
Move score libs to pkgs/development/haskell-modules/default.nix. This seems like a better place for them. Instead of doing “base = null;” we now can use the actual base here.
f6ca623
to
4134557
Compare
I honestly have no idea how to fix the |
eval fixupPhase | ||
''; | ||
}; in builtins.listToAttrs (map (mkCoreLib ghc) (super.ghc.libraries or [])); |
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.
Indentation?
@@ -208,6 +208,45 @@ stdenv.mkDerivation (rec { | |||
|
|||
# Our Cabal compiler name | |||
haskellCompilerName = "ghc-8.4.3"; |
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.
Unrelated issue here, btw
@matthewbauer This PR is quite old at this point, is there anything in particular that needs to be done to move it forward? Or could we go ahead and close it? |
Yes closing for now. It may be useful in the future but not in the current state |
This moves core libraries in Haskell to its own derivations. This is
needed to avoid references to the GHC compiler ending up in binaries
built by GHC. Instead of referencing GHC directly, these binaries will
now link to the copies.
Unfortunately, for this to work, we need to know which GHC libraries
exist at evaluation time. This requires maintaining a list of the
builtin library names & their versions in the GHC compiler’s “libs”
attribute. A better way of handling this is needed.
This is still a work in progress.
/cc @kirelagin @bgamari @ElvishJerricco