Skip to content

Copy CA derivations without the drv file #6769

Open
@thufschmitt

Description

CA derivations separate the “output path” of a derivation (an opaque blob of data as far as Nix is concerned) and the “realisation”, which is the bit of data proving that a given derivation produced a given store path.

For input-addressed derivations, this information is implicit in the store path because its hash is directly computed from the derivation.

This means that for CA derivations, copying the output path isn't enough to get all the needed information, we also need to copy the realisation. This realisation doesn't depend on the presence of the drv file, so it can be copied independently. And running something like nix copy nixpkgsCA#hello --to ssh-ng://machine2 will copy the output path of nixpkgsCA#hello as well as the realisation for this derivation output.
However, there's no way on the command-line to access a realisation without having the .drv file available. For example, even if everything is already built, the above command will instantiate nixpkgsCA#hello to get its drv, and from there infer the realisation to copy. This means that although the realisation is present on machine2, there's no way to copy it from there to somewhere else.

A concrete issue with that (reported by @elaforge here) is that it plays badly with remote builds: Because the .drv aren't instantiated on the remote builders, there's no way to copy the built outputs direcly from a remote builder to a binary cache (which means more roundtrips to the evaluator, and more latency).

Describe the solution you'd like

A way, from the CLI, to refer to a realisation without needing the .drv file to be there

Activity

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

Metadata

Metadata

Assignees

Labels

ca-derivationsDerivations with content addressed outputs

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions