lorri icon indicating copy to clipboard operation
lorri copied to clipboard

`lorri shell` error message says to use a `--show-trace` option that does not exist

Open tshaynik opened this issue 4 years ago • 1 comments

Describe the bug

When running lorri shell, if the evaluation fails due to an EvalError, the underlying nix-shell error message is returned which encourages the user to "use '--show-trace' to show detailed location information". However, lorri shell does not have a --show-trace flag, so the error message is confusing.

While usually, lorri daemon builds (and fails) silently in the backround, I find myself invoking the lorri shell directly in order to see the error message if lorri has failed. When I first encountered the message to use --show-trace and tried to heed the advice only to find that the flag did not exist, I found it frustrating, so it could be a source of frustration to new users.

To Reproduce Steps to reproduce the behavior:

  1. Create a shell.nix with a build input that does not exit:
{ pkgs ? import <nixpkgs> {} }:

pkgs.mkShell {
  buildInputs = [
    pkgs.hellohello

    # keep this line if you use bash
    pkgs.bashInteractive
  ];
}
  1. Run lorri shell. Output is:
lorri: building environment.. done
Aug 27 10:42:55.877 ERRO Build failed. No cached environment available.
Build error: Nix process returned exit code 1.
$ "nix-instantiate" "-vv" "--add-root" "/tmp/.tmpzAvNks/result" "--indirect" "--argstr" "runTimeClosure" "/nix/store/sf8qqzxmxx2k2h7vmr0h3k7nk4sfw9sj-runtime-closure.nix" "--argstr" "src" "/home/myuser/Documents/Programming/Learning/fail/shell.nix" "--" "/home/myuser/.cache/lorri/cas/3a83fbad2f114b4f4f431db2014c985c"
trace: using storePath
error: --- EvalError --- nix-instantiate
at: (5:5) in file: /home/myuser/Documents/Programming/Learning/fail/shell.nix

     4|   buildInputs = [
     5|     pkgs.hellohello
      |     ^
     6| 

attribute 'hellohello' missing
(use '--show-trace' to show detailed location information)

  1. Run lorri shell --show-trace
error: Found argument '--show-trace' which wasn't expected, or isn't valid in this context

Expected behavior

Either:

  • a lorri shell --show-trace option should exist, which passes the --show-trace flag to nix-shell

Or

  • the "(use '--show-trace' to show detailed location information)" line is not included in the lorri shell error message

(I prefer the first option, and I would be happy to implement it, if you think it makes sense!)

Metadata

$ lorri info --shell-file shell.nix

lorri version: 1.1
GC roots exist, shell_gc_root: "/home/myuser/.cache/lorri/gc_roots/28cfd13fd135690f7734c7c5adf99eb7/gc_root/shell_gc_root"

$ uname -a

Linux myhostname 5.4.57 #1-NixOS SMP Fri Aug 7 07:34:02 UTC 2020 x86_64 GNU/Linux

Additional context

Thanks!

tshaynik avatar Aug 27 '20 17:08 tshaynik

Makes a lot of sense to me. :+1:

Profpatsch avatar Sep 24 '20 12:09 Profpatsch