nix build --rebuild on an unbuilt derivation fails with "some outputs of '...' are not valid, so checking is not possible" #485

Open
opened 2024-08-23 23:37:38 +00:00 by rbt · 1 comment
Owner

Describe the bug

If you use nix build --rebuild or nix-build --check on a derivation that has not been built locally yet, Nix will fail with an inscrutable error message that does not indicate you should remove the --rebuild flag.

Steps To Reproduce

With unbuilt.nix:

derivation {
  name = "unbuilt";
  builder = "bash";
  system = "aarch64-darwin";
}
$ nix build --rebuild --file unbuilt.nix
error: some outputs of '/nix/store/dljzaa16741fjkb0qs1bfcxjjrhqycx5-unbuilt.drv' are not valid, so checking is not possible

Note that this derivation will fail to build, but for a different reason:

$ nix build --file unbuilt.nix
error: builder for '/nix/store/dljzaa16741fjkb0qs1bfcxjjrhqycx5-unbuilt.drv' failed with exit code 1;
       last 1 log lines:
       > error: executing 'bash': Undefined error: 0
       For full logs, run 'nix-store -l /nix/store/dljzaa16741fjkb0qs1bfcxjjrhqycx5-unbuilt.drv'.

Expected behavior

Really it should just go ahead and build the derivation, but I would settle for it telling me to remove the --rebuild flag.

nix --version output

nix (Lix, like Nix) 2.91.0

Additional context

#66 looks very similar, but it's emitted from a different code path.

## Describe the bug If you use `nix build --rebuild` or `nix-build --check` on a derivation that has not been built locally yet, Nix will fail with an inscrutable error message that does not indicate you should remove the `--rebuild` flag. ## Steps To Reproduce With `unbuilt.nix`: ```nix derivation { name = "unbuilt"; builder = "bash"; system = "aarch64-darwin"; } ``` ``` $ nix build --rebuild --file unbuilt.nix error: some outputs of '/nix/store/dljzaa16741fjkb0qs1bfcxjjrhqycx5-unbuilt.drv' are not valid, so checking is not possible ``` Note that this derivation _will_ fail to build, but for a different reason: ``` $ nix build --file unbuilt.nix error: builder for '/nix/store/dljzaa16741fjkb0qs1bfcxjjrhqycx5-unbuilt.drv' failed with exit code 1; last 1 log lines: > error: executing 'bash': Undefined error: 0 For full logs, run 'nix-store -l /nix/store/dljzaa16741fjkb0qs1bfcxjjrhqycx5-unbuilt.drv'. ``` ## Expected behavior Really it should just go ahead and build the derivation, but I would settle for it telling me to remove the `--rebuild` flag. ## `nix --version` output ``` nix (Lix, like Nix) 2.91.0 ``` ## Additional context #66 looks very similar, but it's emitted from a different code path.
rbt added the
bug
label 2024-08-23 23:37:38 +00:00
Owner

dupe #281, but your report is better, so im going to close the other one.

dupe https://git.lix.systems/lix-project/lix/issues/281, but your report is better, so im going to close the other one.
jade added the
E/help wanted
E/reproducible
labels 2024-09-26 00:45:47 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lix-project/lix#485
No description provided.