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

Allow derivations in meta #2532

Open
Ekleog opened this issue Nov 11, 2018 · 9 comments
Open

Allow derivations in meta #2532

Ekleog opened this issue Nov 11, 2018 · 9 comments

Comments

@Ekleog
Copy link
Member

Ekleog commented Nov 11, 2018

It looks like nix refuses to have derivations in meta for some operations (eg. exporting as JSON):

bool DrvInfo::checkMeta(Value & v)

This has caused NixOS/nixpkgs#50230, after the change in NixOS/nixpkgs#44439.

Currently, the solution appears to be to use passthru.tests instead of meta.tests, which is a possibility but appears semantically wrong.

Would it be possible to make Nix able to have derivations in meta? I think a legitimate display value for these would be the result of instantiating the derivation, without building it.

Alternatively, I think checkMeta should be called at each build, so that it's not possible to miss it like we did :)

@edolstra
Copy link
Member

edolstra commented Nov 12, 2018

meta is really not intended for this. It's a list of name/value pairs for use by nix-env. Indeed passthru should be used instead.

@Ekleog
Copy link
Member Author

Ekleog commented Nov 12, 2018

It's indeed the workaround implemented in NixOS/nixpkgs#50233, but it feels (at least to me) semantically wrong.

Then, if meta is to stay a list of stringifyable things only, I guess it'd be useful to make sure such breakage can't fly under the radar again, eg. by making building a derivation run checkMeta on it?

@edolstra
Copy link
Member

Doesn't make-tarball.nix in Nixpkgs already catch this?

@grahamc
Copy link
Member

grahamc commented Nov 12, 2018 via email

@Ekleog
Copy link
Member Author

Ekleog commented Nov 13, 2018

For make-tarball.nix I don't really know but it appears it passed. As for ofborg I think it passed because the check-meta.nix had been adapted to accept derivations, and ofborg didn't expect nix to perform additional checks on meta in some cases more than the people who had reviewed the original RFC?

@JohnAZoidberg
Copy link
Member

Is the conclusion to use passthru instead or do we want to further discuss it?

@domenkozar
Copy link
Member

The former :) It would be good to document this better though.

@stale
Copy link

stale bot commented Feb 20, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the stale label Feb 20, 2021
@stale
Copy link

stale bot commented Apr 28, 2022

I closed this issue due to inactivity. → More info

@stale stale bot closed this as completed Apr 28, 2022
@thufschmitt thufschmitt reopened this Feb 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants