Skip to content

Allow derivations in meta #2532

Closed as not planned
Closed as not planned

Description

@Ekleog

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 :)

Activity

  1. edolstra commented on Nov 12, 2018

    @edolstra
    Member

    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.

  2. Ekleog commented on Nov 12, 2018

    @Ekleog
    MemberAuthor

    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?

  3. edolstra commented on Nov 12, 2018

    @edolstra
    Member

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

  4. grahamc commented on Nov 12, 2018

    @grahamc
    Member
  5. Ekleog commented on Nov 13, 2018

    @Ekleog
    MemberAuthor

    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?

  6. JohnAZoidberg commented on Apr 28, 2019

    @JohnAZoidberg
    Member

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

  7. domenkozar commented on Apr 29, 2019

    @domenkozar
    Member

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

  8. stale commented on Feb 20, 2021

    @stale

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

  9. stale commented on Apr 28, 2022

    @stale

    I closed this issue due to inactivity. → More info

  10. tomberek commented on Aug 13, 2026

    @tomberek
    Contributor

    Closing as stale. Re-open if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions