Skip to content

nix/review_shell.nix: use ignoreSingleFileOutputs whenever available #427

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ShamrockLee
Copy link

@ShamrockLee ShamrockLee commented Nov 5, 2024

This PR depends on NixOS/nixpkgs#353752 and fixes #408 partially.

Cc: @corngood

@Mic92
Copy link
Owner

Mic92 commented Nov 5, 2024

Thanks. Looks good.

@ShamrockLee
Copy link
Author

Considering that the single-file-output error is a potential way to enforce the correctness of meta.outputsToInstall, we may want to preserve such behavior while proving options to ignore those single-file outputs.

I prepared the implementation to support nixpkgs-review --ignore-single-file-outputs locally. I could push it up if we agree that this should be supported through a flag.

@Mic92, what do you think?

Copy link

@corngood corngood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if it's something to do with the change in evaluation methods, but lately I'm getting a lot more file conflicts due to "test.*" being included in attrs.nix, so it would be nice to get this in.

ignoreCollisions = true;
};
env =
local-pkgs.buildEnv {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this needs parens around the attrset update, so ignoreSingleFileOutputs makes it into buildEnv.

It does seem to work okay once that's changed.

@ShamrockLee
Copy link
Author

@corngood Thank you for rewiewing!

Do you think it's preferred to have ignoreSingleFileOutputs = true by default (the current implementation), or provide a flag --ignore-single-file-outputs to opt in explicitly?

@corngood
Copy link

Do you think it's preferred to have ignoreSingleFileOutputs = true by default (the current implementation), or provide a flag --ignore-single-file-outputs to opt in explicitly?

My gut feeling is that it should be a default, because people often run nixpkgs-review without knowledge of what's actually going to be built, and there are a bunch of things in nixpkgs that will break if they do happen to be built as part of a review. For example, I hit this on every update to dotnet-sdk, because of things in tests.dotnet.

However, you did mention this:

Considering that the single-file-output error is a potential way to enforce the correctness of meta.outputsToInstall

and I don't really understand what you mean by it. Maybe you can give an example?

@ShamrockLee
Copy link
Author

However, you did mention this:

Considering that the single-file-output error is a potential way to enforce the correctness of meta.outputsToInstall

and I don't really understand what you mean by it. Maybe you can give an example?

$ nix build --impure --expr "let pkgs = import ./. { }; in pkgs.buildEnv { name = ''empty-file-env''; paths = [ (pkgs.emptyFile.overrideAttrs (previousAttrs: { meta = previousAttrs.meta or { } // { outputsToInstall = [ ]; }; })) ]; }"

$ nix build --impure --expr "let pkgs = import ./. { }; in pkgs.buildEnv { name = ''empty-file-env''; paths = [ (pkgs.emptyFile.overrideAttrs (previousAttrs: { meta = removeAttrs previousAttrs.meta or { } [ ''outputsToInstall'' ]; })) ]; }"
error: builder for '/nix/store/2g6w6l2gc2inj96gji5fnaycyjc15rfb-empty-file-env.drv' failed with exit code 255;
       last 1 log lines:
       > error: The store path /nix/store/ij3gw72f4n5z4dz6nnzl1731p9kmjbwr-empty-file is a file and can't be merged into an environment using pkgs.buildEnv! at /nix/store/qrwjx5798fsp5yxaawrf5aklh1hp2xba-builder.pl line 115.
       For full logs, run 'nix log /nix/store/2g6w6l2gc2inj96gji5fnaycyjc15rfb-empty-file-env.drv'.

@ShamrockLee
Copy link
Author

but lately I'm getting a lot more file conflicts due to "test.*" being included in attrs.nix

Is it the default behavior now? I thought it would be opt-in.

@corngood
Copy link

Is it the default behavior now? I thought it would be opt-in.

It's the top level tests attribute, not e.g. passthru.tests. It seems to be something to do with the github eval. See this review run:

NixOS/nixpkgs#389338 (comment)

  • tests.dotnet.final-attrs.check-output
  • tests.dotnet.final-attrs.output-matches-const
  • tests.dotnet.final-attrs.override-has-no-effect

etc

That one was done with github eval. Below that I posted a darwin review, which used local eval, and it didn't build anything in tests.

@ShamrockLee ShamrockLee changed the title nix/review_shell.nix: use ignoreFileOutputs whenever available nix/review_shell.nix: use ignoreSingleFileOutputs whenever available Mar 20, 2025
@corngood
Copy link

That one was done with github eval. Below that I posted a darwin review, which used local eval, and it didn't build anything in tests.

I looked into this a bit, and I think it's just the difference between local eval using nix-env -qaP and the eval action using release-attrpaths-superset.nix.

I didn't realise they were so drastically different (essentially opt-in vs opt-out).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Review shell fails when there are single-file inputs.
3 participants