travisbhartwell/nix-emacs

How can we improve responsiveness when nix-shell has to install things?

chris-martin opened this issue · 1 comments

After updating a nix channel or garbage collecting the nix store, nix-shell may need to do a lot of setup (which, particularly when Haskell dependencies are involved, might take tens of minutes). When this happens, Emacs becomes completely unresponsive when it blocks on a command wrapped by nix-shell.

Is there any way we can improve on this situation?

Yeah, I know this issue. I used synchronous IO to implement nix-sandbox. The way to solve this would be to use asynchronous IO, but if for example flycheck asks for the path to some checker and nix-sandbox would simply return nil and start some nix-shell process in the background, flycheck cannot be used after the background job finishes.

A compromise would be to use synchronous IO, but to display the output of nix-shell to the user. This requires receiving the standard output and standard error stream of the nix-shell process and to be able to separate them in emacs. I could not figure out yet how to do this.