Skip to content

Feature: add primop to collect & present warnings at the end of building #1197

@moretea

Description

@moretea

As an alternative to abort in NixOS/nixpkgs#22096, it would be perfectly acceptable to have nix-build print a list of warnings at the end of the evaluation.

I image that a log primop could be used to build this functionality, which would behave the same as builtins.trace; it will generate some (non-observable) side effect and then continue with evaluating the second argument.

builtins.log { showToUser = true; severity = "warning"; message = "Your nixpkgs is deprecated";} restOfExpression
$ nix-build ...
<some build output>
Warning: your nixpkgs is deprecated
<more build output>

There were some warnings during building:
- Warning: your nixpkgs is deprecated
/nix/store/asdf-pkg-1.0/
builtins.log { showToUser = true; severity = "critical"; message = "Your nixpkgs is unsupported";} restOfExpression
$ nix-build ...
<some build output>
CRITICAL: your nixpkgs is unsupported
<more build output>

There were some CRITICAL errors during building:
- CRITICAL: your nixpkgs is unsupported
/nix/store/asdf-pkg-1.0/

Metadata

Metadata

Assignees

Labels

error-messagesConfusing messages and better diagnosticsfeatureFeature request or proposallanguageThe Nix expression language; parser, interpreter, primops, evaluation, etcstale
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions