Rerun succesful nixos test
states that to run a nixos test you simply call nix-build on it.
This will work only until the first success - then the previous output path will simply be returned without performing any of the tests.
There is a --check flag but that one breaks the return code of the test, since instead of reporting the success status of the test you end up with a non-zero status since the test output was not exactly the same as the previous run.

Does anyone happen to have some trick they use in such situations?


nix-store --delete the test result?

1 Like

Here’s a hack I’ve been using to rebuild while preserving logs and status: dotfiles/nix-rebuild at 9470d24b11e2d32bf9585c14ce959a9d94262076 · timokau/dotfiles · GitHub


I can confirm that after first deleting the result symlink this does work.
@basvandijk thanks!

It never occured to me that it might be possible to manually delete store paths, after all it is like manually calling free in a garbage collected language :man_shrugging: (yes, I get that the command performs checks, just pointing out that it is unexpected).