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
Revert "Revert "hslib: Function to extract the haskell build inputs of a package."" #33158
Conversation
I think it's fine to add the |
@peti I'm very frustrated about this. Isn't this exactly what you suggested in #23023 , which you used as justification to revert 3001b82 and feffade ? I would like to have a generic way to access the haskell build inputs of a given haskell package in the exact same way as we build the nix-shell env, without a hack like |
To be clear, I have been using this functionality for months to build nix-buffer environments, and finally gave up and implemented #23023 when I found another use case in building hoogle-ready environments. This specific PR is unlikely to be used much within nixpkgs itself, but the feature it enables has been tested actively by production haskell development teams. |
I am perfectly happy with adding that function to |
Then I have to duplicate all of the logic in generic.nix, and keep them up to date. I would strongly prefer my original approach of just re-exporting this information in passthru, or the approach of this PR to share the logic. I expect doing otherwise to cause eventual divergence, hopefully that will be caught quickly by me but most likely will be caught by a developer who is not a nix expert and will, at best, expend several of their (and, eventually, my) hours and some of their goodwill toward nix-based development environments to fix the issue. I do not understand why neither of the solutions I proposed that would keep things in sync is acceptable. That being said, if you insist I'll push a version of this without the changes to generic-builder.nix. |
Yes, that is true. However, I find that preferable over exposing internals of the generic builder in a public API that other people then want to rely on. Once we do that, we can no longer change internals of our build function without breaking 3rd party code that may not even be a part of Nixpkgs. |
We can namespace most of this to be internal and just expose the bits we're comfortable keeping stable. There's a similar concern about stable APIs even if the absence of code sharing... |
572313d
to
5098272
Compare
Pushed without changes to the generic builder. |
5098272
to
7b3c364
Compare
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.
Some minor nits ...
@@ -348,7 +348,9 @@ stdenv.mkDerivation ({ | |||
|
|||
passthru = passthru // { | |||
|
|||
inherit pname version; | |||
inherit pname version 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.
I'd rather not export an attribute called ghc
to denote the compiler. There are plenty of other Haskell compilers and even though we don't use them much now, we might in the future. Maybe this would better be called compiler
?
inherit pname version; | ||
inherit pname version ghc; | ||
|
||
isHaskellPkg = true; |
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'd prefer a definition like isHaskellPackage = drv: drv ? isHaskellLibrary
in lib.nix
. That definition of isHaskellPkg
seems redundant (and its name feels inconsistent with the spelled-out isHaskellLibrary
rather than isHaskellLib
).
}).haskellBuildInputs; | ||
|
||
ghcInfo = ghc: | ||
rec { isCross = (ghc.cross or null) != null; |
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.
Would isCross = ghc ? cross
suffice? Can cross
be null
?
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'm not sure, this is just the logic currently in generic-builder.nix. @Ericson2314 would know better.
…f a package."" Trying again, without changing the generic builder. This reverts commit 65138e8.
7b3c364
to
1ee61d8
Compare
Addressed all comments but the one. |
Woah I really don't like the duplication. @peti I agree we're grossly spilling the guts here, but now I have to crawl through 3 sources of truth (generic-builder, lib, and generic-builder env) to fix all the deps for cross. This is going to really be a pain, and I'll take the grossness not the pain. |
@Ericson2314, I totally see your point. The question is just, what do you suggest we do? Exposing all those internals is no good solution either. Personally, I view these new functions as experimental and I would not go out of my way updating them when I make changes to the generic builder because I don't even khow to test that code. |
@peti If its experimental, then we can break it at any point. It's just another implementation that happens to be in the "wrong file". I wouldn't be too surprised if @shlevy was OK with a situation where perhaps you just ensured that nixpkgs at least evals whenever you change it, and he's on the hook for making sure whatever uses he introduces still work semantically. That's not great, but arguably better than what we have now. Longer term, we have some nixpkgs |
Longer term still, I hope to finally have time to teach |
Trying again waiting on review from @peti.
This reverts commit 65138e8.