Skip to content

Nix flakes should not cache evaluation errors #3872

@Mic92

Description

@Mic92

Describe the bug

Currently error messages are only showed the first time they appear.
After that the error message looks like this:

$ sudo nixos-rebuild switch
building the system configuration...
error: --- EvalError -------------------------------------------------------------------------- nix
cached failure of attribute 'nixosConfigurations.turingmachine.config.system.build.toplevel.drvPath'

The problem is that the error message of the first time might be no longer visible,
so users would get stuck not knowing what its going on.

Steps To Reproduce

  1. Create an invalid nixos configuration i.e. add two conflicting options (but valid nix syntax)
  2. Run nixos-rebuild switch:
error: --- ThrownError --------------------------------------------------------------------------- nix
The option `system.nixos.versionSuffix' has conflicting definitions, in `<unknown-file>' and `<unknown-file>'.
(use '--show-trace' to show detailed location information)
  1. Run nixos-rebuild switch again:
building the system configuration...
error: --- EvalError -------------------------------------------------------------------------- nix
cached failure of attribute 'nixosConfigurations.turingmachine.config.system.build.toplevel.drvPath'

Expected behavior

It should not cache evaluation failures and show me the message agin

nix-env --version output

$ nix-env --version
nix-env (Nix) 2.4pre20200721_ff314f1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugerror-messagesConfusing messages and better diagnosticsflakeslanguageThe Nix expression language; parser, interpreter, primops, evaluation, etc

    Projects

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions