Skip to content

Virtual path semantics that are deterministic, lazy and suitable for performing deduplication of values by a path value key. #10689

Open
@roberth

Description

Is your feature request related to a problem? Please describe.

This issue discusses the solution space for a crucial step to make NixOS evaluation not copy nixpkgs to the store.

#6530 solves the problem of lazy fetching while using the module system, by introducing another problem, which is new observable nondeterminism in the form of virtual path string placeholders (/nix/store/virtual0000<n>).

Lazy paths (#10252) also add laziness, but the module system's use of paths causes it to have to copy nonetheless.

Describe the solution you'd like

Some possible solutions

This is an unsolved problem. Lazy trees will leak non-deterministic virtual path names in this case, which in my view is the primary reason why we can't just adopt that solution.
Possible solutions I'm aware of

  • make the module system perform the transformation instead. This should be possible to do entirely in Nix. (1. split into virtual root path and relative path string without context, 2. maintain a mapping from virtual root path to numbered placeholders, 3. insert those placeholders into the module paths, so that they're just strings)
    • O(n) unless something is added to the language (nondeterministicComparePathRoot function? nondeterministicPathRootIdString? A new "path map" type?)
    • not transparent
    • slows down the module system if it's complicated on the expression side
  • allow path values as attribute names
    • only depends on lazy path values
    • order is non-deterministic, unless we require a source fingerprint (or disallow a bunch functions??)
  • allow strings (with context) in attribute names
    • requires a proper lazy path strings implementation
    • same concern about order nondeterminism

Additional context

Discussed in meeting before, links tbd.

Also came up in

Priorities

Add 👍 to issues you find important.

Metadata

Assignees

No one assigned

    Labels

    featureFeature request or proposalfetchingNetworking with the outside (non-Nix) world, input lockinglanguageThe Nix expression language; parser, interpreter, primops, evaluation, etc

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions