travisbhartwell / nix-emacs

A set of useful Emacs modes and functions for users of Nix and Nix OS.
225 stars 32 forks source link

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

Open chris-martin opened 8 years ago

chris-martin commented 8 years ago

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?

svenkeidel commented 8 years ago

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.