lorri silently fails when shell.nix doesn't build
Describe the bug
Currently lorri will automatically watch the shell.nix file for changes and rebuild the environment when it is modified. This is really awesome! But unfortunately when shell.nix is edited, but does not build properly -- syntax error, package not found, etc -- there's no indication given to the user that their changes have not been applied...
To Reproduce Steps to reproduce the behavior:
lorri initin a directory.cdinto the directory with direnv to automatically enter into the lorri environment.- Edit
shell.nixwith a "good" edit, eg. addpkgs.python3. - Go back to the terminal and press enter. Note that now you
which python3gives you a nix path. - Edit
shell.nixagain, but this time with a "bad" edit, eg. rename topkgs.python3asdfasdfasdf. - Go back to the terminal and press enter. Notice that behind the scenes lorri attempted to build the environment and failed, but there's no indication of this at all to the user.
Expected behavior An error message.
Metadata
n/a
$ lorri info
error: The following required arguments were not provided:
--shell-file <nix_file>
USAGE:
lorri info --shell-file <nix_file>
For more information try --help
$ uname -a
Linux skainswo-X58A-UD3R 5.4.0-42-generic #46-Ubuntu SMP Fri Jul 10 00:24:02 UTC 2020 x86_64 GNU/Linux
Additional context
n/as
That is a good insight. We could maybe query the daemon in the lorri direnv call (via a command that does not yet exist) and display a warning if the last build failed.
This would work by adding a lorri internal project-status or similar, which returns the required information (e.g. last build crashed), similar to how lorri internal stream-events shows some history at the beginning.
lorri direnv would add a call to lorri internal project-status, which itself would print the warnings. This means every time direnv is invoked (either by the editor or the shell), we get the latest project status and it will be printed.