From c6605992c06bf6adc93a7bb19b0ed34b8c213bf3 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Tue, 16 Jan 2024 21:14:38 +0200 Subject: feat(tvix/glue): drive builds on IO MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit That's one possible abstraction to drive builds. Whenever IO into a store path is requested, we look up the root node, and in case we don't have it in PathInfoService, but KnownPaths gives us a Derivation for that output path, trigger a build and await the result. This recursively might trigger builds for parent paths if they haven't been built yet. Another option would be to simply expose a PathInfoService interface for a builder too, and loop all building into IO via PathInfoService composition - but let's start with something. Note tvix-cli doesn't have a configurable BuildService yet, it's plugged to the DummyBuildService, so whenever it needs to do a build, it'll fail, but that's how it can be provoked: ``` (builtins.readFile (import {}).hello.outPath + "/bin/hello") […] error[E029]: I/O error: /nix/store/cg8a576pz2yfc1wbhxm1zy4x7lrk8pix-hello-2.12.1: builds are not supported with DummyBuildService --> [code]:1:2 | 1 | (builtins.readFile (import {}).hello.outPath + "/bin/hello") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ``` Note how this fails, while pure output path calculation (`(import {}).hello.outPath + "/bin/hello")`) still succeeds. Change-Id: Id2075d8a2b18554d0dd608b4b29146a8cd411e7f Reviewed-on: https://cl.tvl.fyi/c/depot/+/10793 Reviewed-by: raitobezarius Tested-by: BuildkiteCI --- tvix/Cargo.nix | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tvix/Cargo.nix') diff --git a/tvix/Cargo.nix b/tvix/Cargo.nix index 28ef774ac71f..a39c8ef38d54 100644 --- a/tvix/Cargo.nix +++ b/tvix/Cargo.nix @@ -10618,6 +10618,10 @@ rec { then lib.cleanSourceWith { filter = sourceFilter; src = ./glue; } else ./glue; dependencies = [ + { + name = "async-recursion"; + packageId = "async-recursion"; + } { name = "bstr"; packageId = "bstr"; @@ -10630,6 +10634,10 @@ rec { name = "data-encoding"; packageId = "data-encoding"; } + { + name = "futures"; + packageId = "futures"; + } { name = "nix-compat"; packageId = "nix-compat"; -- cgit 1.4.1