[haskell-updates] ghc.withPackages: Add wrapper for ghcide #89450
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation for this change
This might be controversial. So I am open to different approaches.
This is the problem:
When installing packages via
ghc.withPackages
,ghcide
will not work on projects relying on this. Because the cabal in that project will choose the version of a dependency provided by ghc.withPackageswhich then
ghcidewhich does package discovery on it‘s own can‘t find, because it can‘t find packages from the wrapped
ghc`.What I did
When building
ghc.withPackages
withghcide
as a package. Theghcide
binary will be wrapped with the same environment variables asghc
.Alternatives
The alternative is to tell users to grep the variables from the ghc wrapper used. But users will probably not find that documentation early and in between they have a broken ghcide which is hard to debug.
Problems
The problem with this approach is, that this will only help, if the user installs
ghcide
viaghc.withPackages
. It wont work ifghcide
is installed separately ashaskellPackages.ghcide
.Yet I think that is useful setup that would be nice to support.
Of course special casing for certain packages in withPackages should be limited. If there is another more modular approach to achieve this, I would be open to that.
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)