Skip to content
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-updates] ghc.withPackages: Add wrapper for ghcide #89450

Merged
merged 1 commit into from Jun 5, 2020

Conversation

maralorn
Copy link
Member

@maralorn maralorn commented Jun 4, 2020

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 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)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

Copy link
Member

@cdepillabout cdepillabout left a comment

Choose a reason for hiding this comment

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.

@maralorn
Copy link
Member Author

maralorn commented Jun 4, 2020

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 peti merged this pull request into NixOS:haskell-updates Jun 5, 2020
@maralorn maralorn deleted the ghcide-wrapper branch June 5, 2020 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants