-
-
Notifications
You must be signed in to change notification settings - Fork 367
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
Nix flake fix dev shells #2655
Nix flake fix dev shells #2655
Conversation
I'm a little wary of this. It's nice if you know it's there, but it's hidden magic and adds a source of confusion ("I can't cabal build with 9.0", "I can".... "oh, one of us was using the magic cabal wrapper"). |
I agree. What about if the alias is called
|
That sounds fine to me, although at that point I might as well type |
6a313b4
to
9958922
Compare
A few changes:
|
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.
Personally, I'm in favour of what you do here, just having the dev shell contain the system dependencies and letting cabal build the rest. In fact, that's what I do already (I don't use the existing dev shells for that reason!). However, possibly some people (@berberman ?) like the way it's done currently.
the nix build in master is failing since https://github.com/haskell/haskell-language-server/actions/runs/1778521865 (the merge of #2668):
|
912f631
to
9048cdc
Compare
I've pushed a change with both type of shell (i.e. simple deps where cabal builds the dependencies, or complete deps). I've also changed the CI so it builds HLS and shells for all flavors of them, effectively populating cachix for them. |
Yes:
I'm having a look. |
@jneira the build is now fixed, but now that HLS is not statically linked anymore, it does have the nix I initially thought that it should not be an issue, because people are actually using HLS to develop with GHC, so chances are that they also pull |
Developement shell for macos for GHC 8.8.4 is failing. I have no idea how to fix that, I'll disable it. |
Theses tools are pulled in the shell, but we don't need them to match the GHC version used for development. Said otherwise, as long as we use a working `cabal-install` to build with GHC 9.2, we don't care if that cabal-install was built with GHC 8.10. This gives more chance for theses tools to work and be in the binary cache of nixpkgs.
Using alias, we get the "correct" behavior when typing `cabal build` in the nix-shell, it points to the current cabal-project file.
This commit restores a working behavior for `nix-shell` or `nix develop`, for all supported GHC versions. When entering a `nix-shell`, or `nix develop .#haskell-language-server-ghcXxX-dev` you will get an environment with all the dependencies needed to run `cabal build`. Haskell dependencies will be built by cabal instead of nix. This may be more robust compared to a shell where dependencies are built by nix: - It won't try to build any dependency with nix. This mean that it won't benefit from nix caching, but on the other hand, it will perfectly match the cabal plan. - The nix shell may fail to start if an (possibly unneeded) dependency was failing to build. Entering nix-shell also generates an alias command `cabal_project` which runs cabal with the correct project file if needed (e.g. for GHC 9.0 and 9.2). Users are notified with a message when entering the shell. The old behavior (i.e. where dependencies are built with nix) is still available with `nix develop .#haskell-language-server-xxx-dev-nix` (i.e. suffix the name of the shell with `-nix`).
All HLS version can be built with `nix build .#all-haskell-language-server`, and all development shells with `nix build .#all-dev-shells`. I had to workaround a limitation in `nix build` which is not able to build multiples targets, instead I used linkFarmFromDrvs. All packages and shells are now named with a unique package name containing the GHC version.
Related to haskell#2668. This fixs the build, however, because now HLS is dynamicly linked, it pulls GHC as a dependency. The uncompressed closure size is now `~6GiB`.
b398d1b
to
00aa810
Compare
I've disable nix dev shell building for all but the current GHC version. (i.e. that's strictly more than what was previously tested). Let's see if it passes test like that, then we'll merge and later I'll try to fix it. |
33cbffe
to
00aa810
Compare
I don't understand the latest failing job. Could we merge with that? |
LGTM! |
Now trying to actually use this:
🤷 |
Setting |
I'm sorry. I tried your second example and it works fine for me. Have you tried For the first one
I can indeed reproduce the problem ;( However it works for me with |
No need to apologize, just reporting!
Yes, I suspect you may be right.
Aha, that does it! I just blindly copied it out of the PR description because I was trying to figure out how to trigger one of the other shells. I should have checked more closely! It does indeed work with the right attribute name 🤦 |
I use auto completion (with zsh or bash) to get the available entry points. |
This is a work in progress.
This clean and fixs the
nix develop
shells for GHC 9.2 and GHC 9.0.See individual commits for details, but in summary:
nix develop .#haskell-language-server-ghc921-dev
now works.cabal
which points to the correctcabal-xxx.project
I'm planning on testing on GHC 9.0 soon too (but right now it is building the world of dependencies).
Future commits to this MR will (hopefully) includes:
if version == ...