Skip to content

Haskell Server Wrapper Function for Stack specific $PATH #111

@Pitometsu

Description

@Pitometsu

I have errors like

Severity: DsError
Message:  haskell-language-server: could not execute: hspec-discover

when run haskell-language-server. I guess the reason is because hspec-discover in package.yaml:tests:build-tools:, and so installed by stack (not by nix-shell as rest, not-build-specific, tools).

But I have no such problems when run it like env PATH=$PATH:`bash -c 'source <(stack config env); echo $PATH'` haskell-language-server.

I can't just run stack exec haskell-language-server to just simply have all the stack's environments available, because stack using nix --pure for more robust and reproducible builds, and so that cause nix shells conflicts (not sure -- is it because of shells recursivity, or stack can't decide, which nix shell is build one, according to STACK_IN_NIX_SHELL environment variable, I guess).


So the question is: how construction like env PATH=$PATH:`bash -c 'source <(stack config env); echo $PATH'` haskell-language-server could be passed to lsp-haskell-server-wrapper-function properly?

Possible workaround would be: just add each tool from stack's package.yaml:tests:build-tools: (like hspec-discover here) into top-level shell.nix, but that would be fragile and require continuous project build tools consistency manual maintaining.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions