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

Fix nix why-depends --derivation #7539

Merged
merged 3 commits into from
Jan 5, 2023

Conversation

thufschmitt
Copy link
Member

Reverts #7337 and re-implements it in a different way in order to not break nix why-depends --derivation.

Fix #7496

Cc @raphaelr

Théophane Hufschmitt added 2 commits January 2, 2023 15:44
- Test with `--derivation`
- Actually test with ca-derivations (was suuposedly done, but not
  activated because of a missing line in `local.mk`)
@thufschmitt thufschmitt requested a review from edolstra as a code owner January 2, 2023 16:41
@thufschmitt thufschmitt added ca-derivations Derivations with content addressed outputs bug labels Jan 2, 2023
@thufschmitt thufschmitt requested a review from Radvendii January 2, 2023 16:41
This has the same goal as b13fd4c,but
achieves it in a different way in order to not break
`nix why-depends --derivation`.
@thufschmitt thufschmitt force-pushed the fix-nix-why-depends--derivation branch from 93b5d8d to 8cac451 Compare January 2, 2023 16:42
@Radvendii
Copy link
Contributor

Radvendii commented Jan 3, 2023

  • Using Realise::Derivation here tells it to only realise the derivation, and not go further (i.e. it won't try to resolve the output if it hasn't already been resolved).
  • operateOn tells it to return the store path of the derivation if invoked with --derivation.

Is that right?

@raphaelr
Copy link
Contributor

raphaelr commented Jan 4, 2023

Can confirm that this fixes the issue:

$ nix run 'github:NixOS/nix/pull/7539/head' -- why-depends --derivation -f . libsForQt5.qtbase nasm
/nix/store/6mr2fs8z9arz8wfc357szvcnz3vvmxv4-qtbase-5.15.7.drv
└───/nix/store/9kzlffpxzj7zf3fmz637y5glkqnawj99-libjpeg-turbo-2.1.4.drv
    └───/nix/store/wpd81rvxfd3lc4qf0l5dls5fq3p0vdny-nasm-2.15.05.drv

@thufschmitt
Copy link
Member Author

  • Using Realise::Derivation here tells it to only realise the derivation, and not go further (i.e. it won't try to resolve the output if it hasn't already been resolved).

    • operateOn tells it to return the store path of the derivation if invoked with --derivation.

Is that right?

Not exactly: Realise::Derivation is some kind of dry-run mode. Unless you also pass OperateOn::Derivation, it will still try to return the output path (despite not building it). So it fails if the derivation is an unbuilt CA derivation (hence the try-catch block).

@edolstra edolstra merged commit 0fe2b22 into NixOS:master Jan 5, 2023
@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/tweag-nix-dev-update-43/25185/1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug ca-derivations Derivations with content addressed outputs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

nix why-depends --derivation gives false negatives on Nix 2.12
5 participants