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 generic-builder: Always use separate pkg db for custom setup #41939
haskell generic-builder: Always use separate pkg db for custom setup #41939
Conversation
Second eval of https://hydra.nixos.org/jobset/nixpkgs/ericson2314-haskell-updates will test this. |
Let's wait on this for a little bit if that's okay. It looks like it could break things if we're not careful. |
I came here to open a pull request with exactly the same changes as a proposed fix to #39646, so I’ll say instead that from my experience this works pretty well and I think this needs to be merged. |
This decreases complexity and ensures setup dependencies are properly specified with `setup-depends` as they should be. Testing will say if this is a reasonable change.
75908aa
to
f8ec07e
Compare
My old eval had some mysterious failure on some GHCs. https://hydra.nixos.org/eval/1464372 is another attempt. |
@Ericson2314 Oh, I saw something similar. Cabal clearly has missing setup depends, and some other packages might as well. See e.g. https://github.com/NixOS/nixpkgs/pull/39735/files#diff-8f392bd0e4fd42a66d9e0cd4901ec287R1055. |
@kirelagin Thanks. I took the opportunity to rebase that PR of yours while I was at it. |
Oh, cool, thank you! |
Indeed with 600 builds left and no new fails. I hereby declare it good enough. Most people are asleep now anyways, and I have another thing to fix. |
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.
It does not feel right to have that code in Nixpkgs. IMHO, it belongs into cabal2nix
at https://github.com/NixOS/cabal2nix/blob/master/src/Distribution/Nixpkgs/Haskell/FromCabal/PostProcess.hs#L35.
Also, I don't understand why this change is applied to all Cabal_*
attributes. As far as I know, Cabal_1_*
does need depend on parsec
, right`? So the addition should be unnecessary there. Furthermore, both of these libraries are core libraries in ghc 8.4.x and beyond, so these additions shouldn't be necessary for that compiler either.
@peti I've never understood the criterion for which goes in
Well, that would be adding a null dep then? Seems harmless enough. OTOH the effect of letting the wired-in-ness of libraries to pollute everything is quite messy. |
Suppose build A is broken due to a missing dependency. If you fix that issue via Now, contrast to the fix being added to Arguably, almost all overrides in The reason we're not doing that is that it's more work, Nix contributors feel more comfortable hacking Nixpkgs than they feel hacking Haskell code in Since that's the reality we live in, I use the following rule of thumb to distinguish between those changes that should go into A second criteria is whether the overrides in
to https://github.com/NixOS/cabal2nix/blob/master/src/Distribution/Nixpkgs/Haskell/FromCabal/PostProcess.hs#L35 accomplishes the same thing without run-time cost, so that seems like the better solution to me.
I worry about communicating intend to people who may be reading that code. The intention of that code is to fix |
Thank you for that very thorough explanation @peti! |
This is now handled by cabal2nix: - NixOS/cabal2nix@7ccbd66. - NixOS#41939
@@ -284,14 +276,13 @@ stdenv.mkDerivation ({ | |||
# dependencies for the build machine. | |||
# | |||
# pkgs* arrays defined in stdenv/setup.hs | |||
+ (optionalString useSeparateSetupDb '' | |||
+ '' |
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.
@Ericson2314 I think this is causing the ARGMAX issue lately - this gives us way more --extra-*-dirs than we used to have. Can we be smarter at avoiding duplicates here? buildPkgDb
will add to arg length much more than ordinary -L stuff.
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.
In a later PR, isn't it changed so that --extra-*
flags are not made for the setup.hs package db?
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.
Ok but the separate setup db thing could still be an issue. Here is the line that is hitting argmax:
ghc -package-db=/var/folders/l4/v2k_52x55r3_bf4cty3g4bg00000gn/T//setup-package.conf.d -j4 -threaded --make -o Setup -odir /var/folders/l4/v2k_52x55r3_bf4cty3g4bg00000gn/T/ -hidir /var/folders/l4/v2k_52x55r3_bf4cty3g4bg00000gn/T/ Setup.hs
GHC must not know how to deal with ARGMAX correctly in package-db.
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.
OK huh that's really weird because I'd suspect that package db is super small. I think the real issue is having ghc as two different types of deps on native causes the setup hook to be run twice, which then without strict deps effectively causes the env hooks to be run twice more than they were without strict deps already.
Motivation for this change
This decreases complexity and ensures setup dependencies are properly specified with
setup-depends
as they should be. Testing will say if this is a reasonable change.Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)CC @ElvishJerricco