commercialhaskell / commercialhaskell/stack
stack build --file-watch, with nix: should Stack re-launch the nix-shell when we change stack.yaml?
- Dominant language
- Haskell
- Stars
- 4.1k
- Forks
- 850
- Avg merge
- 10h 37m
- Merged PRs (30d)
- 4
Description
Consider the following scenario:
You're working in a Stack project that contains `nix: enable` in the `stack.yaml`. You run `stack build --file-watch`, and then the build fails. You realize that you forgot to add a required nix package to the nix `packages` list in your `stack.yaml`---so you go and edit `stack.yaml`, adding the necessary package.
At this point, stack could theoretically notice that you changed the `nix` section of `stack.yaml`, and relaunch the nix-shell (so that the new dependency is in scope), and then start the build again.
However, that's not what currently happens. Currently, it restarts the build, but in the existing nix-shell environment; so the package that you added to your config doesn't actually become in scope. So, every time you make a change to a nix setting in `stack.yaml`, you need to Ctrl-C out of `stack build --file-watch` and run `stack build --file-watch` again.
Does it seem like a good idea to relaunch the nix-shell when the user changes stack.yaml? The existing work-around isn't too inconvenient, but I think this change shouldn't be too hard. I'd be willing to submit a PR if you all think this is a good idea.
Contributor guide
Assessment
This issue has not been assessed yet.