1

Stack has

stack build --file-watch

which automatically recompiles a Haskell project whenever files change. Does nix have something analogous with nix-build, or is there a well-known tool which can help achieve these?

George
  • 6,927
  • 4
  • 34
  • 67
  • Not a feature of `nix-build`, but perhaps a different tool could be used to call `nix-build`, such as these suggestions: "FAQ: I want to run arbitrary commands when arbitrary files change..." https://github.com/ndmitchell/ghcid#i-want-to-run-arbitrary-commands-when-arbitrary-files-change – Peter Becich Nov 19 '22 at 08:14
  • For Haskell and Nix this https://stackoverflow.com/q/67312833/1007926 may be relevant – Peter Becich Nov 19 '22 at 08:15

1 Answers1

1

Nix does not provide this functionality by itself. Lorri comes close, but its focus is on providing an instant "nix-shell" via direnv. It is not currently suitable for building and testing your project like stack build --file-watch does. If you're interested, you could create an issue to discuss such a feature with the authors.

Robert Hensing
  • 6,708
  • 18
  • 23