nix develop doesn't work for derivations that don't set outputs attribute #556

Open
opened 2024-10-22 09:55:09 +00:00 by lilyball · 0 comments
Member

Describe the bug

nix develop fails for a derivation created using the derivation built-in that doesn't set the outputs attribute. The derivation built-in documentation states that the outputs attribute is optional and defaults to the single output "out" but nix develop assumes the outputs attribute is present.

> nix develop --impure -E 'with import (builtins.getFlake "nixpkgs") {}; { x = derivation { name = "foo"; builder = lib.getExe bash; args = [ "-c" "echo foo > $out" ]; system = builtins.currentSystem; }; }' x
error: builder for '/nix/store/jc4cp175lcrz47ddhsy9ybsj6sbvimgr-foo-env.drv' failed to produce output path for output 'out' at '/nix/store/8i9w2wzyvany45vv8gksz4mi025hdddp-foo-env'

Adding the outputs = [ "out" ]; attribute causes the command to work.

nix --version output

nix (Lix, like Nix) 2.92.0-dev-pre20240925-8a6b84d

## Describe the bug `nix develop` fails for a derivation created using the `derivation` built-in that doesn't set the `outputs` attribute. The `derivation` built-in [documentation](https://docs.lix.systems/manual/lix/stable/language/derivations.html) states that the `outputs` attribute is optional and defaults to the single output `"out"` but `nix develop` assumes the `outputs` attribute is present. ```console > nix develop --impure -E 'with import (builtins.getFlake "nixpkgs") {}; { x = derivation { name = "foo"; builder = lib.getExe bash; args = [ "-c" "echo foo > $out" ]; system = builtins.currentSystem; }; }' x error: builder for '/nix/store/jc4cp175lcrz47ddhsy9ybsj6sbvimgr-foo-env.drv' failed to produce output path for output 'out' at '/nix/store/8i9w2wzyvany45vv8gksz4mi025hdddp-foo-env' ``` Adding the `outputs = [ "out" ];` attribute causes the command to work. ## `nix --version` output nix (Lix, like Nix) 2.92.0-dev-pre20240925-8a6b84d
lilyball added the
bug
label 2024-10-22 09:55:09 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
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#556
No description provided.