haskell/hie-bios

Allow overriding workdir in `hie.yaml`

TeofilC opened this issue · 4 comments

Context

At work we use stack with HLS. But we also use stack to run our application/tests. By default HLS will build things into the same stack workdir as regular calls to the stack command line. We've found this leads to excessive rebuilding as HLS and regular stack "fight".

Feature request

stack cradles should have a workdir setting that allows overriding the workdir so that it doesn't interfere with non-HLS usages of stack.
I feel like cabal could have a similar setting but I don't know if this is a problem that cabal faces.

Workaround

Right now what I do is copy our stack.yaml and append a line that specifies a custom work-dir and then tell hie-bios to use that modified stack.yaml file.

This definitely got solved in the past for cabal, it uses a separate build dir under ~/.cache/hie-bios. I'm surprised we don't have the same for stack.

Stack doesn't allow an absolute path dir for the builddir, only relative to the work dir and claims it is Cabal's fault.

dten commented

from an hls point of view it turns out this is pretty easily done at a higher level using the env settings in the plugins that call hls and providing STACK_WORK