Haskell-language-server: Calling cabal build in nix-shell fails

Created on 6 Aug 2020  路  9Comments  路  Source: haskell/haskell-language-server

Gives error:

[cody@nixos:~/code/haskell-language-server]$ nix-shell --pure --run "cabal build"
Warning: Requested index-state2020-07-27T12:40:45Z is newer than
'hackage.haskell.org'! Falling back to older state (2020-07-23T01:35:56Z).
Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] trying: ghcide-0.2.0 (user goal)
[__1] next goal: lsp-test (dependency of ghcide)
[__1] rejecting: lsp-test-0.10.3.0/installed-BEL0YuFHxCdHyQYBLVjxpT (conflict:
ghcide => lsp-test>=0.11.0.2 && <0.12)
[__1] trying: lsp-test-0.11.0.2
[__2] trying: haskell-language-server-0.2.2.0 (user goal)
[__3] rejecting: haskell-language-server:!test (constraint from config file,
command line flag, or user target requires opposite flag selection)
[__3] rejecting: haskell-language-server:*test (conflict: lsp-test==0.11.0.2,
haskell-language-server *test => lsp-test>=0.11.0.3)
[__3] fail (backjumping, conflict set: haskell-language-server, lsp-test,
haskell-language-server:test)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: ghcide, lsp-test,
haskell-language-server, haskell-language-server:test
Try running with --minimize-conflict-set to improve the error message.

Building with stack in the meantime and will report if that's an adequate workaround for the time being.

build nixos bug

All 9 comments

Not sure why it's building the ghcide tests, but should be fixable with a constraint bump in ghcide

I haven't used cabal in forever since I've been using stack so I'm not sure what you meant.

I just removed the tests from the cabal file for now and it's building :sweat_smile:

Edit: nevermind, I had set --allow-newer in some config file. New error is:

Warning: Requested index-state2020-07-27T12:40:45Z is newer than
'hackage.haskell.org'! Falling back to older state (2020-07-23T01:35:56Z).
Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] next goal: ghcide (user goal)
[__0] rejecting: ghcide-0.2.0 (constraint from user target requires ==0.1.0)
[__0] trying: ghcide-0.1.0
[__1] trying: ghcide:-ghc-lib
[__2] next goal: hie-bios (dependency of ghcide -ghc-lib)
[__2] rejecting: hie-bios-0.5.1/installed-imznkM3AihCAjSZAxNQgA,
hie-bios-0.6.1, hie-bios-0.6.0, hie-bios-0.5.1, hie-bios-0.5.0 (conflict:
ghcide -ghc-lib => hie-bios>=0.4.0 && <0.5)
[__2] trying: hie-bios-0.4.0
[__3] next goal: haskell-language-server (user goal)
[__3] rejecting: haskell-language-server-0.2.2.0 (conflict: hie-bios==0.4.0,
haskell-language-server => hie-bios^>=0.6.1)
[__3] fail (backjumping, conflict set: haskell-language-server, hie-bios)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: ghcide, hie-bios,
haskell-language-server, ghcide:ghc-lib
Try running with --minimize-conflict-set to improve the error message.

I'll have to relearn cabal dependency fixing later today :smile:

It looks like stack build also failed for me:

[nix-shell:~/code/haskell-language-server]$ stack build

Error: While constructing the build plan, the following exceptions were encountered:

In the dependencies for ghcide-0.1.0:
    hie-bios-0.6.1 from stack configuration does not match >=0.4.0 && <0.5  (latest matching version is 0.4.0)
needed since ghcide is a build target.

Some different approaches to resolving this:

  * Set 'allow-newer: true' in /home/cody/.stack/config.yaml to ignore all version constraints and build anyway.

  * Recommended action: try adding the following to your extra-deps in /home/cody/code/haskell-language-server/stack.yaml:

- hie-bios-0.4.0@sha256:e2d4abef43824d99846d8e08889f3c5ba2ea58414a400ba000d9e6488987a08a,8590

Plan construction failed.

and following it's instructions results in the probably unsurprising to you guys:

[nix-shell:~/code/haskell-language-server]$ stack build
The same package name is used in multiple local packages

hie-bios used in:
- PLImmutable (PLIHackage (PackageIdentifier {pkgName = PackageName "hie-bios", pkgVersion = mkVersion [0,4,0]}) e2d4abef43824d99846d8e08889f3c5ba2ea58414a400ba000d9e6488987a08a,8590 (TreeKey a97096c854e4cdb227d54f45c628d486e710bfda063b3c8ff5e0d15108ef1d90,6579))
- PLImmutable (PLIHackage (PackageIdentifier {pkgName = PackageName "hie-bios", pkgVersion = mkVersion [0,6,1]}) 72a2d15fbddc21ac8b6d796bedaf2a8d3eb07b78a26e3e0817e583c116f01f21,12124 (TreeKey 0f4e00856edbcef1cb2ac3cb65761c7698ab8ca7975bd601905833daada4838f,11009))

I suspect that this is a user error, someone has forgotten to run git submodule update perhaps?

To prevent the Nix shell from actually breaking, it would be great to add a Nix CI job.

I suspect that this is a user error, someone has forgotten to run git submodule update perhaps?

[nix-shell:~/code/haskell-language-server]$ git submodule update
Submodule path 'ghcide': checked out '530c327d50283a071d53476415d8df27cc1cae6f'

[nix-shell:~/code/haskell-language-server]$ cabal build
Warning: Requested index-state2020-07-27T12:40:45Z is newer than
'hackage.haskell.org'! Falling back to older state (2020-07-23T01:35:56Z).
Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] trying: ghcide-0.2.0 (user goal)
[__1] next goal: lsp-test (dependency of ghcide)
[__1] rejecting: lsp-test-0.10.3.0/installed-BEL0YuFHxCdHyQYBLVjxpT (conflict:
ghcide => lsp-test>=0.11.0.2 && <0.12)
[__1] trying: lsp-test-0.11.0.2
[__2] trying: haskell-language-server-0.2.2.0 (user goal)
[__3] rejecting: haskell-language-server:!test (constraint from config file,
command line flag, or user target requires opposite flag selection)
[__3] rejecting: haskell-language-server:*test (conflict: lsp-test==0.11.0.2,
haskell-language-server *test => lsp-test>=0.11.0.3)
[__3] fail (backjumping, conflict set: haskell-language-server, lsp-test,
haskell-language-server:test)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: ghcide, lsp-test,
haskell-language-server, haskell-language-server:test
Try running with --minimize-conflict-set to improve the error message.

Edit: to erase any doubt in my or others minds... maybe this works:

[nix-shell:~/code/haskell-language-server]$ git log --oneline -n1
7cdbf8c (HEAD -> master, origin/master, origin/HEAD) Merge pull request #289 from bubba/win-doc-url-fix

[nix-shell:~/code/haskell-language-server]$ git submodule update --init --recursive

[nix-shell:~/code/haskell-language-server]$ cabal build
Warning: Requested index-state2020-07-27T12:40:45Z is newer than
'hackage.haskell.org'! Falling back to older state (2020-07-23T01:35:56Z).
Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] trying: ghcide-0.2.0 (user goal)
[__1] next goal: lsp-test (dependency of ghcide)
[__1] rejecting: lsp-test-0.10.3.0/installed-BEL0YuFHxCdHyQYBLVjxpT (conflict:
ghcide => lsp-test>=0.11.0.2 && <0.12)
[__1] trying: lsp-test-0.11.0.2
[__2] trying: haskell-language-server-0.2.2.0 (user goal)
[__3] rejecting: haskell-language-server:!test (constraint from config file,
command line flag, or user target requires opposite flag selection)
[__3] rejecting: haskell-language-server:*test (conflict: lsp-test==0.11.0.2,
haskell-language-server *test => lsp-test>=0.11.0.3)
[__3] fail (backjumping, conflict set: haskell-language-server, lsp-test,
haskell-language-server:test)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: ghcide, lsp-test,
haskell-language-server, haskell-language-server:test
Try running with --minimize-conflict-set to improve the error message.

To prevent the Nix shell from actually breaking, it would be great to add a Nix CI job.

That'd be awesome! I might be able to help here. I was trying to figure out how to fit this method using cachix into the current build process. I use it for my "hci" or glorified emacs configuration CI and it's pretty snappy even though I include X11/xfvb-run.

That submodule update did make a difference though, as the error message no longer references ghcide 0.1.0.

Now for good measure please do a git pull origin master followed by another submodule update.

[nix-shell:~/code/haskell-language-server]$ git pull origin master
From https://github.com/haskell/haskell-language-server
 * branch            master     -> FETCH_HEAD
Already up to date.

[nix-shell:~/code/haskell-language-server]$ git submodule update --init --recursive

[nix-shell:~/code/haskell-language-server]$ cabal build
Warning: Requested index-state2020-07-27T12:40:45Z is newer than
'hackage.haskell.org'! Falling back to older state (2020-07-23T01:35:56Z).
Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] trying: ghcide-0.2.0 (user goal)
[__1] next goal: lsp-test (dependency of ghcide)
[__1] rejecting: lsp-test-0.10.3.0/installed-BEL0YuFHxCdHyQYBLVjxpT (conflict:
ghcide => lsp-test>=0.11.0.2 && <0.12)
[__1] trying: lsp-test-0.11.0.2
[__2] trying: haskell-language-server-0.2.2.0 (user goal)
[__3] rejecting: haskell-language-server:!test (constraint from config file,
command line flag, or user target requires opposite flag selection)
[__3] rejecting: haskell-language-server:*test (conflict: lsp-test==0.11.0.2,
haskell-language-server *test => lsp-test>=0.11.0.3)
[__3] fail (backjumping, conflict set: haskell-language-server, lsp-test,
haskell-language-server:test)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: ghcide, lsp-test,
haskell-language-server, haskell-language-server:test
Try running with --minimize-conflict-set to improve the error message.


[nix-shell:~/code/haskell-language-server]$ git log --oneline -n1
7cdbf8c (HEAD -> master, origin/master, origin/HEAD) Merge pull request #289 from bubba/win-doc-url-fix

Have you deleted the cabal.project or any other file by chance?

I wouldn't be asking all these questions if I wasn't positive that the nix.shell file does work, btw.

Have you deleted the cabal.project or any other file by chance?

I wouldn't be asking all these questions if I wasn't positive that the nix.shell file does work, btw.

That was with a clean working directory on 7cdbf8c.

Was this page helpful?
0 / 5 - 0 ratings