-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Describe the bug
When running nix-shell -p <name>, if <name> is not found, it will show a complicated-looking trace, as opposed to a clear error message.
For experienced users, this is not an issue, as they are used to reading parse traces, and filtering out this kind of noise.
For beginner users however, this is an issue:
This does not point them toward a solution, as none of the files shown in the trace are written by them.
And can even lead them to believe nix-shell itself broke.
As for wether this is a bug or an improvement request, the line is always blurry with UX.
In this case I believe exposing novice users to internal workings of a built-in construct to be bad enough to be considered a bug.
(Especially as it might be one of the very first commands they run)
Steps To Reproduce
- Run
nix-shell -p cowsya - Get:
error:
… while calling the 'derivationStrict' builtin
at <nix/derivation-internal.nix>:37:12:
36|
37| strict = derivationStrict drvAttrs;
| ^
38|
… while evaluating derivation 'shell'
whose name attribute is located at /nix/store/px86fbsnq65agwvrxnylrxnxp6bpcl76-source/pkgs/stdenv/generic/make-derivation.nix:480:13
… while evaluating attribute 'buildInputs' of derivation 'shell'
at /nix/store/px86fbsnq65agwvrxnylrxnxp6bpcl76-source/pkgs/stdenv/generic/make-derivation.nix:535:13:
534| depsHostHost = elemAt (elemAt dependencies 1) 0;
535| buildInputs = elemAt (elemAt dependencies 1) 1;
| ^
536| depsTargetTarget = elemAt (elemAt dependencies 2) 0;
(stack trace truncated; use '--show-trace' to show the full, detailed trace)
error: undefined variable 'cowsya'
at «string»:1:107:
1| {...}@args: with import <nixpkgs> args; (pkgs.runCommandCC or pkgs.runCommand) "shell" { buildInputs = [ (cowsya) ]; } ""
| ^
Expected behavior
- Run
nix-shell -p cowsya - Get something like:
Package cowsya was not found
Or even
Package cowsya was not found
Did you mean "cowsay" ?
Metadata
nix-env (Nix) 2.28.5
Checklist
- checked latest Nix manual (source)
- checked open bug issues and pull requests for possible duplicates
Add 👍 to issues you find important.