You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 thenghcidewhich does package discovery on it‘s own can‘t find, because it can‘t find packages from the wrappedghc`.
What I did
When building ghc.withPackages with ghcide as a package. The ghcide binary will be wrapped with the same environment variables as ghc.
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 via ghc.withPackages. It wont work if ghcide is installed separately as haskellPackages.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
Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
Built on platform(s)
NixOS
macOS
other Linux distributions
Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
Tested execution of all binary files (usually in ./result/bin/)
Determined the impact on package closure size (by running nix path-info -S before and after)
The reason will be displayed to describe this comment to others. Learn more.
I haven't actually tried running ghcide from this PR, but given that we have to do a similar thing in this script for other programs like haddock, it seems reasonable that we should do it for ghcide as well.
@maralorn I'll leave this open so that others can review it as well, but if no one responds in a week or so, please feel free to ping me and I'll merge it in.
One crazy thought I had about this was: Maybe we just want to wrap all installed binaries like that, that would remove the special casing.
But I am not sure what negative side effects that could have …
peti
merged this pull request
into
NixOS:haskell-updatesJun 5, 2020
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,ghcidewill not work on projects relying on this. Because the cabal in that project will choose the version of a dependency provided by ghc.withPackageswhich thenghcidewhich does package discovery on it‘s own can‘t find, because it can‘t find packages from the wrappedghc`.What I did
When building
ghc.withPackageswithghcideas a package. Theghcidebinary 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
ghcideviaghc.withPackages. It wont work ifghcideis 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
sandboxinnix.confon non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"./result/bin/)nix path-info -Sbefore and after)