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

align system retrieval with nix-build #1303

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

Conversation

DavHau
Copy link
Member

@DavHau DavHau commented Oct 8, 2023

Read the system from the instantiated derivation instead of getting it from the eval time drv attrs.

This is better in terms of correctness as it derives the system through a derivations string context, instead of relying on builder implementations to set the system attribute correctly.

This derivation for example did not build with hydra before while it builds fine with the nix repl:

:b { name="hello"; type="derivation"; drvPath = hello.drvPath; }

Read the system from the instantiated derivation instead of getting it from the eval time drv attrs.

This is better in terms of correctness as it derives the system through a derivations string context, instead of relying on builder implementations to set the `system` attribute correctly.

This derivation for example did not build with hydra before while it builds fine with the nix repl:

```
:b { name="hello"; type="derivation"; drvPath = hello.drvPath; }
```
Copy link
Member

@roberth roberth left a comment

Choose a reason for hiding this comment

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

Besides removing a risk, this simplifies the language-level interface.

if (drv->querySystem() == "unknown")
throw EvalError("derivation must have a 'system' attribute");
auto drvContent = state.store->readDerivation(drv->requireDrvPath());
Copy link
Member

Choose a reason for hiding this comment

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

I'm concerned about how much IO this is going to introduce for a project like Nixpkgs.

Copy link
Member

Choose a reason for hiding this comment

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

I would expect them to still be in the page cache, but we could cache parsed derivations on the Nix side to save some context switches and a little bit of computation.

Copy link
Member

Choose a reason for hiding this comment

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

Also do we even need to return the system here? I have some doubts that we in fact do.

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.

4 participants