Skip to content

Builtin fetching should be representable by derivations #9077

@roberth

Description

@roberth

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

Built-in fetchers block the evaluator. It's not possible to instantiate a derivation until the hash of the fetched source is computed.

Instead of fetching a source (inputSrc) we could represent built-in fetchers using a derivation, similar to builder = "builtins:fetchurl";.

This has the advantage that fetching the input can be

  • delayed
  • parallelized
  • not be done at all, when dependents are substitutable

Describe the solution you'd like

Represent built-in fetching using derivations.

Fetch these outputs using built-in implementations that are not sandboxed, but trusted by virtue of being in Nix (as we do with fetchTree etc)

When scheduling the derivations, request for the Nix client to perform addToStore instead of scheduling an actual derivation build.

Describe alternatives you've considered

A representation of builtin fetchers that doesn't piggyback on derivations. We'd be reinventing the wheel, and interleaving with drv scheduling would be hard.

Additional context

  • fetchTree cleanup #9061
  • niv is more efficient than flake = false flake inputs
  • Can integrate with Lazy trees #6530 but non-atomic fetching might be harder than in the current situation
    • source filter function needs to keep eval alive (as it currently also does, but it doesn't block)
    • or just fetch it all when filtering needs to happen (as it currently is with FODs)
    • or just let users use ca-derivations to do the filtering

Priorities

Add 👍 to issues you find important.

Metadata

Metadata

Assignees

No one assigned

    Labels

    derivation designIssues to consider for new versions of the derivation format (major or incremental)featureFeature request or proposalfetchingNetworking with the outside (non-Nix) world, input lockinglanguageThe Nix expression language; parser, interpreter, primops, evaluation, etcschedulingstoreIssues and pull requests concerning the Nix store

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions