Skip to content

Derivation JSON env does not adhere to the JSON guidelines #9866

Open
@roberth

Description

Describe the bug

NOTE: Changing how derivations works is rather invasive, so the question for the new-cli effort is whether we want to design this now to be forward compatible with these changes.

Essentially this is inherited from builtins.derivation and the ATerm-based format, but it is exposed on the command line.
This is some deep legacy, but nothing that can't be solved. Solving it is worthwhile because it improves the user experience, complying with the guidelines, and answers other questions such as #9846 without having to come up with something completely arbitrary and subject to change.

Steps To Reproduce

nix derivation show nixpkgs#hello

  • Observe that each derivation has fields

    • args
    • builder
    • env
    • inputDrvs
    • inputSrcs
    • name
    • outputs
    • system

    These look well defined, but env is not. It may contain various attributes, such as preferLocalBuild, etc, which affect scheduling and have no business being in the process environment.
    (They should not be part of the output fingerprint either; Make output paths/hashes indifferent to possible CA/FOD origin of sources #9259)

  • Observe that the top level is a dictionary. (So the command can't summarize any results without violating the guidelines or switching formats. That may be acceptable.)

Expected behavior

  • Derivations do not rely on env for scheduling attributes and such, because those are Nix-specific fields, not dict entries.
  • Derivations have a section of non-hashed fields; putting these together as fields in a top-level object means that we can add non-output-hashed fields without breaking compatibility with earlier Nix versions.

nix-env --version output

Additional context

Priorities

Add 👍 to issues you find important.

Metadata

Assignees

No one assigned

    Labels

    breakingChanges we can't make without breaking old expressions, changing hashes, etcbugnew-cliRelating to the "nix" command

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions