-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Labels
bugreplThe Read Eval Print Loop, "nix repl" command and debuggerThe Read Eval Print Loop, "nix repl" command and debugger
Description
Describe the bug
The repl formatting is eagerly evaluating attribute values
But only if the attribute set was passed through removeAttrs. ( and so on)
This is particularly annoying because nixpkgs module system has the following line:
config = checked (removeAttrs declaredConfig [ "_module" ]);
And that triggers all otherwise lazy module system errors to be shown in the repl.
- We don't want to show them all at once, only when accessing the attribute.
- The output gives the false sense, that the value is an Error while the actual Error is further down
Steps To Reproduce
nix-repl> orig = { foo = throw "Error"; a = 1; }
nix-repl> orig
{
a = 1;
foo = «error: Error»;
}
nix-repl> res = builtins.removeAttrs orig ["a"]
nix-repl> res
error:
… while calling the 'throw' builtin
at «string»:1:31:
1| builtins.removeAttrs { foo = throw "Error"; a = 1; } ["a"]
| ^
error: Error
{
Expected behavior
Formatting shouldn't get affected by removeAttrs or any other primops.
Metadata
Confirmed on:
nix-env (Nix) 2.30.2
nix-env (Nix) 2.28.5
Additional context
Checklist
- checked latest Nix manual (source)
- checked open bug issues and pull requests for possible duplicates
Add 👍 to issues you find important.
Metadata
Metadata
Assignees
Labels
bugreplThe Read Eval Print Loop, "nix repl" command and debuggerThe Read Eval Print Loop, "nix repl" command and debugger