Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.inputDerivation broken for __structuredAttrs derivations #321005

Closed
j-baker opened this issue Jun 19, 2024 · 3 comments · Fixed by #361233
Closed

.inputDerivation broken for __structuredAttrs derivations #321005

j-baker opened this issue Jun 19, 2024 · 3 comments · Fixed by #361233
Labels
0.kind: bug Something is broken

Comments

@j-baker
Copy link
Contributor

j-baker commented Jun 19, 2024

Describe the bug

Every derivation has a .inputDerivation that can be used to e.g. create a dev shell. The runtime dependencies of this derivation are the build dependencies of the parent.

On my computer, on the two packages I've tried, if __structuredAttrs = true is set for the parent, the inputDerivation will fail to build.

nix-repl> :b aspectj.inputDerivation
error: builder for '/nix/store/3aqm51iaklikz3vpchgyzm7ikbhkyqc1-aspectj-1.9.22.1.drv' failed to produce output path for output 'out' at '/nix/store/7k1rvvhqv79z1fcak9c81076lpwzm7zq-aspectj-1.9.22.1'

nix-repl> :b (aspectj.overrideAttrs { __structuredAttrs = false; }).inputDerivation

This derivation produced the following outputs:
  out -> /nix/store/jr3ryc1fs5kk8arjm91jy1dsd9h55y22-aspectj-1.9.22.1

Steps To Reproduce

nix-repl> :b aspectj.inputDerivation
error: builder for '/nix/store/3aqm51iaklikz3vpchgyzm7ikbhkyqc1-aspectj-1.9.22.1.drv' failed to produce output path for output 'out' at '/nix/store/7k1rvvhqv79z1fcak9c81076lpwzm7zq-aspectj-1.9.22.1'

nix-repl> :b (aspectj.overrideAttrs { __structuredAttrs = false; }).inputDerivation

This derivation produced the following outputs:
  out -> /nix/store/jr3ryc1fs5kk8arjm91jy1dsd9h55y22-aspectj-1.9.22.1

Expected behavior

Succeeds

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

Add any other context about the problem here.

Notify maintainers

@roberth seems to have made a bunch of PRs to this piece of code!


Add a 👍 reaction to issues you find important.

@j-baker j-baker added the 0.kind: bug Something is broken label Jun 19, 2024
@infinisil
Copy link
Member

#215173

@j-baker
Copy link
Contributor Author

j-baker commented Jun 19, 2024

Interesting - that approach changes the code to use structuredAttrs. it might just be simpler to unset structuredAttrs in the override (or otherwise, to always set structuredattrs). No specific need to use structuredattrs for this bit only.

@infinisil
Copy link
Member

Certain derivation attribute values such as foo = { bar = 10; } are only valid with __structuredAttrs, so that wouldn't quite work :)

wolfgangwalther added a commit to wolfgangwalther/nixpkgs that referenced this issue Dec 2, 2024
The goal is to print all store references into $out.

First, $out itself is not defined with structuredAttrs, but we can work
around that with placeholder. Alternatively we could source
$stdenv/setup after sourcing the attrs.sh file, but that feels like
overkill.

To support structuredAttrs we source the attrs.sh file. export will not
be enough anymore, because the attrs file sets bash variables, not
environment variables. Thus we resort to declare -p.

Resolves NixOS#321005
RedEtherbloom pushed a commit to RedEtherbloom/nixpkgs that referenced this issue Dec 4, 2024
The goal is to print all store references into $out.

First, $out itself is not defined with structuredAttrs, but we can work
around that with placeholder. Alternatively we could source
$stdenv/setup after sourcing the attrs.sh file, but that feels like
overkill.

To support structuredAttrs we source the attrs.sh file. export will not
be enough anymore, because the attrs file sets bash variables, not
environment variables. Thus we resort to declare -p.

Resolves NixOS#321005
mkg20001 pushed a commit to mkg20001/nixpkgs that referenced this issue Dec 5, 2024
The goal is to print all store references into $out.

First, $out itself is not defined with structuredAttrs, but we can work
around that with placeholder. Alternatively we could source
$stdenv/setup after sourcing the attrs.sh file, but that feels like
overkill.

To support structuredAttrs we source the attrs.sh file. export will not
be enough anymore, because the attrs file sets bash variables, not
environment variables. Thus we resort to declare -p.

Resolves NixOS#321005
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants