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
haskell: Split boot libraries into individual outputs #43017
Conversation
* Rename `ghc` to `compiler`. * Explicitly pass native compiler where needed. * Always use explicitly passed compiler, never pull it from the haskell package set.
pkgs/top-level/haskell-packages.nix
Outdated
@@ -115,68 +118,78 @@ in rec { | |||
# Default overrides that are applied to all package sets. | |||
packageOverrides = self : super : {}; | |||
|
|||
# Always get compilers from `buildPackages` |
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.
Probably I shouldn’t have removed this part.
But I have to admit that I don’t understand the difference between a compiler from packages
and a compiler from buildPackages
. I think one from packages
is expected to run on host and target target, while the one from buildPackages
is expected to run on build and target host, is that right? In that case, how do we a get a compiler used for Setup.hs
, i.e. one that both runs on and targets build?
@Ericson2314
compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-head.nix { }; | ||
}; | ||
ghcjs = packages.ghcjs82; | ||
ghcjs710 = callPackage ../development/haskell-modules rec { | ||
buildHaskellPackages = ghc.bootPkgs; |
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 have no idea how ghcjs works, but I really don’t understand this part. buildHaskellPackages
are packages used for Setup.hs
(at least I think I read something like this in comments). So why is it ghc.bootPkgs
here?
(I guess, cc @Ericson2314 as well)
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.
ghc.bootPkgs
would become compiler.bootPkgs
here. The idea is we are using the same package set we used to build GHCJS to build Setup.hs.
So it seems to work well and actually fixes the original issue, so I’m going to do the same to other compilers. |
7a99c9e
to
945326c
Compare
@GrahamcOfBorg eval |
I'm generally super duper happy about these changes, except for the |
@@ -31,13 +32,21 @@ | |||
}: | |||
|
|||
let | |||
inherit (bootPkgs) ghc; |
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.
So e.g. this would be inherit (bootPkgs) hscolour; bootCompiler = bootPkgs.compiler;
@@ -15,6 +16,16 @@ let | |||
libEnvVar = stdenv.lib.optionalString stdenv.hostPlatform.isDarwin "DY" | |||
+ "LD_LIBRARY_PATH"; | |||
|
|||
bootPackages = [ |
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.
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.
Wired in packages is a different thing: https://ghc.haskell.org/trac/ghc/wiki/Commentary/Libraries#CouplingtoGHC
@Ericson2314 Thanks for the comments! I think I am starting to understand what is going on, but I still have so many questions!
|
Given that I don’t really understand what is going on, I’ll just revert those changes that are irrelevant, as, I think, we can do well with having a heavily overloaded |
@kirelagin I'll post more when I'm not on my phone (happy to also chat on IRC today), but the short answer to all of those is https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/splice.nix hasn't been done for Haskell packages sets, so all the usual magic of getting the right version doesn't work. I do hate splicing, but maybe I just need to make a |
IRC sounds great, unfortunately, I’m afraid I won’t be available today, we can probably try tomorrow. |
If splicing is not implemented for haskell packages, it means that a wrong compiler is used for |
@kirelagin I wish your second comment was correct! The problem is
|
This is part of the reason why I changed it to passing the compiler explicitly – this way it is easier to track what is going on instead of trying to figure out which ghc comes from which package set and what it means. Regarding the name, I would really prefer those “meta” names to have something special in them, e.g. Another option would be not to pass the compiler explicitly and not put it into the package set, but instead pass a package-set-selector (for example just the name, e.g. |
@kirelagin I tried not adding |
@kirelagin Are you / Serokell still interested in this sort of thing? I lay out in https://gitlab.haskell.org/ghc/ghc/issues/16503 how we're pretty close to being able to build a stage1 GHC that doesn't assume any bootstrapping plan, rather reading everything it needs from the |
@Ericson2314 I, personally, am very interested and Serokell, in principle, too, however I’ll need to check whether we can actually devote any effort to this at the moment. |
Yes this is in part why I was bring up the GHC side of things. The more GHC can optionally "delegate" bootstrapping to the package manager (i.e. the Nix haskell infra), the better job the package manager can do. If you are referring to https://github.com/input-output-hk/nix-tools, I agree we should be using that :). I guess I might be a bit more optimistic in that I think once GHC has its stuff order even the current infra could also take advantage of it too, but regardless, GHC is the choke-point here. |
The documentation for Notably we are using it mostly with a somewhat crude hack to make |
I've got the vast majority of the multi-target work done, and the rest open PRs. That's meant I've been able to start shuffling the build system to ensure no regressions by construction, and also make building things separately more robust: https://gitlab.haskell.org/ghc/ghc/merge_requests/1897/diffs The end is in sight! |
PoC fix for #42069.
Applied only to GHC 8.2.2 because, well, it is just a quick PoC. I would really love to know what you all think.