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

Cannot build HLS for ghc 9.0.1. error: attribute 'haskell-language-server' missing. #5

Open
Zekt opened this issue Aug 28, 2021 · 4 comments

Comments

@Zekt
Copy link

Zekt commented Aug 28, 2021

After running

nix-env --install --file . \
    --attr hls-renamed \
    --attr hls-wrapper-nix \
    --attr cabal-install \
    --attr stack \
    --attr implicit-hie \
    --attr direnv \
    --attr direnv-nix-lorelei \
    --attr ghc

I successfully installed the hls-wrapper-nix and HLS targeting ghc 8.10.4.

But when I want to install a HLS targeting ghc 9.0.1:

nix-env --install --file . \
    --argstr ghcVersion 9.0.1 \
    --arg hlsUnstable true \
	--attr hls-renamed

At first I would get following error messages:

installing 'haskell-language-server-ghc901-renamed'                                                                                    
trace: Checking materialization in /home/vik/repos/nix-haskell-hls/nix/materialized-linux/hls-unstable-ghc901                          
trace: WARNING: No sha256 found for source-repository-package https://github.com/hsyl20/ghc-api-compat 8fee87eac97a538dbe81ff1ab18cff10
f2f9fa15 download may fail in restricted mode (hydra)                                                                                  
trace: Consider adding `--sha256: 16bibb7f3s2sxdvdy2mq6w1nj1lc8zhms54lwmj17ijhvjys29vg` to the cabal.project file or passing in a looku
pSha256 argument                                                                                                                       
building '/nix/store/qpdhv0wgzrs4g1fak4g2vp8pnh50g568-hls-unstable-plan-to-nix-pkgs.drv'...                                            
Materialized nix used for hls-unstable-plan-to-nix-pkgs is missing. To fix run: /nix/store/dj1h0nhlryq4r6n1qjzxbfiwxqin2wy3-updateMater
ialized        
builder for '/nix/store/qpdhv0wgzrs4g1fak4g2vp8pnh50g568-hls-unstable-plan-to-nix-pkgs.drv' failed with exit code 1
error: build of '/nix/store/qpdhv0wgzrs4g1fak4g2vp8pnh50g568-hls-unstable-plan-to-nix-pkgs.drv' failed

After running updateMaterialized as it's suggested and trying to install HLS for ghc 9.0.1 again, I get other errors:

installing 'haskell-language-server-ghc901-renamed'                                                                                    
building '/nix/store/qm7qlaym8aq7mnmhmc93pmrib7nfz3nk-hls-unstable-plan-to-nix-pkgs.drv'...                                            
trace: ERROR: cabal configure failed with:                                                                                             
Cloning into '/build/tmp.rbJHewsvqT/dist-newstyle/src/p0kffic7q_-4762034bf50e7c46'...
HEAD is now at 47f95a6 Minimal Repo For Haskell.Nix            
Your branch is up to date with 'origin/minimal'.               
Warning: The package list for 'hackage.haskell.org-at-2021-08-08T000000Z' is
18867 days old.                                                                                                                        
Run 'cabal update' to get the latest list of available packages.                                                                       
Warning: Requested index-state 2021-08-08T00:00:00Z is newer than
'hackage.haskell.org-at-2021-08-08T000000Z'! Falling back to older state
(2021-08-07T22:27:45Z).                                                                                                                
Resolving dependencies...                                                                                                              
cabal: Could not resolve dependencies:
[__0] trying: ghc-api-compat-8.6.1 (user goal)                                                                                         
[__1] trying: ghc-9.0.1/installed-9.0.1 (dependency of ghc-api-compat)
[__2] trying: base-4.15.0.0/installed-4.15.0.0 (dependency of ghc-api-compat)
[__3] trying: ghcide-1.4.1.0 (user goal)
[__4] next goal: hie-bios (dependency of ghcide)                                                                                       
[__4] rejecting: hie-bios-0.7.5 (conflict: ghc==9.0.1/installed-9.0.1,                         
hie-bios => ghc>=8.4.1 && <8.11)
[__4] skipping: hie-bios-0.7.4, hie-bios-0.7.2, hie-bios-0.7.1,
hie-bios-0.7.0, hie-bios-0.6.3, hie-bios-0.6.2, hie-bios-0.6.1,
hie-bios-0.6.0, hie-bios-0.5.1, hie-bios-0.5.0, hie-bios-0.4.0,
hie-bios-0.3.2, hie-bios-0.3.1, hie-bios-0.3.0, hie-bios-0.2.1,
hie-bios-0.2.0, hie-bios-0.1.1, hie-bios-0.1.0, hie-bios-0.7.3 (has the same
characteristics that caused the previous version to fail: excludes 'ghc'
version 9.0.1)
[__4] fail (backjumping, conflict set: ghc, ghcide, hie-bios)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: ghc, ghcide, hie-bios, base,
ghc-api-compat
Try running with --minimize-conflict-set to improve the error message.

error: attribute 'haskell-language-server' missing, at /home/vik/repos/nix-haskell-hls/nix/default.nix:101:20

It seems that the newest hie-bios on hackage doesn't support ghc 9.0.1, could there be any workarounds to use hie-bios on master branch instead?

@shajra
Copy link
Owner

shajra commented Aug 28, 2021

Yeah, I haven't tried to take on a 9.0.1 build yet, so it's not surprising that there's hiccups. Still, the upstream HLS project supports it. And Haskell.nix also suppports 9.0.1. So I think you're right that it's not not unreasonable to try to get this working.

Two thoughts.

First, when I get to it, it might not actually be that hard. Maybe it's just a matter of upgrading dependencies... like getting the latest Haskell.nix and also updating the timestamp I'm pinning Hackage to. That's typical stuff I have to do when maintaining this project.

Second, though flake builds are supported by HLS upstream, I'm not convinced they build cleanly for all versions of GHC. If they do, then I'd love for someone to show me the invocation that does that (I see derivations that look like they should build, but to date they haven't worked for me for all GHC versions advertised). Because if flakes can do everything, the motivation of using Haskell.nix attenuates strongly for me. It's a bit more maintenance that I care for myself. Though I've found this project useful in the interim thus far.

@Zekt
Copy link
Author

Zekt commented Aug 29, 2021

I've tried to build HLS directly and it works, I think it's because in their stack.yaml for ghc 9.0.1 a specific commit of hie-bios is used (https://github.com/haskell/haskell-language-server/blob/master/stack-9.0.1.yaml#L73-L74), so installing HLS with stack and ghc 9.0.1 works fine, but the same errors arise if cabal is used.

I haven't fully understand this project yet so don't know if the causes are the same or how to fix it, but if it's the case, updating the timestamp of Hackage probably wouldn't change much. Hope this helps.

@shajra
Copy link
Owner

shajra commented Sep 2, 2021

You're right that they are pinning dependencies. But they are doing something else too. They are disabling a whole bunch of plugins too that are not ready for 9.0.1. They do this in the upstream configuration-ghc-901.nix file for flake support as well.

And there's an open issue tracking this all (haskell/haskell-language-server#297).

So... I could try to reproduce this all in my Haskell.nix-based build. The good part about Haskell.nix is that it's largely driven by the Cabal files. Haskell.nix just has a few configurations for specifying either a cabal.project file or a cabal.project.local file. So the work isn't really so much on the Haskell.nix side, but just converting the work that's been done for Stack and flakes to a respective Cabal build.

Maybe that's worth it? Or... I might be lazy and just wait for 9.0.1support to flush through upstream? Not sure just yet.

@shajra
Copy link
Owner

shajra commented Sep 2, 2021

Okay, I put in a couple of hours seeing if I could get this compiling. While I was able to do two more simple things (not build the plugins and put in Cabal flags disabling the dependence on these plugins)... there were still dependencies that needed special attention beyond the latest in Hackage. At that point, I lost steam. Also, just getting the other GHC versions to build is also proving tedious, and I feel more committed to supporting them.

But I welcome anyone else to give this a shot and put up a PR. In the meantime, I'm going to pass on worrying and 9.0.1 for now, and wait for some improved situation upstream.

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

No branches or pull requests

2 participants