about summary refs log tree commit diff
path: root/tvix
diff options
context:
space:
mode:
Diffstat (limited to 'tvix')
-rw-r--r--tvix/boot/tests/default.nix39
1 files changed, 6 insertions, 33 deletions
diff --git a/tvix/boot/tests/default.nix b/tvix/boot/tests/default.nix
index 108803d7abcc..949be35ccf53 100644
--- a/tvix/boot/tests/default.nix
+++ b/tvix/boot/tests/default.nix
@@ -32,14 +32,12 @@ let
       pkgs.stdenv.mkDerivation {
         name = "run-vm";
 
+        __structuredAttrs = true;
+        exportReferencesGraph.closure = [ path ];
+
         nativeBuildInputs = [
           depot.tvix.store
           depot.tvix.boot.runVM
-        ] ++ lib.optionals isClosure [
-          depot.tvix.nar-bridge
-          pkgs.curl
-          pkgs.parallel
-          pkgs.xz.bin
         ];
         buildCommand = ''
           touch $out
@@ -67,34 +65,9 @@ let
 
           echo "imported to $outpath"
         '' + lib.optionalString (isClosure) ''
-          echo "Starting nar-bridge…"
-          nar-bridge-http \
-            --otlp=false \
-            --store-addr=unix://$PWD/tvix-store.sock \
-            --listen-addr=$PWD/nar-bridge.sock &
-
-          # Wait for the socket to be created.
-          while [ ! -e $PWD/nar-bridge.sock ]; do sleep 1; done
-
-          # Upload. We can't use nix copy --to http://…, as it wants access to the nix db.
-          # However, we can use mkBinaryCache to assemble .narinfo and .nar.xz to upload,
-          # and then drive a HTTP client ourselves.
-          to_upload=${pkgs.mkBinaryCache { rootPaths = [path];}}
-
-          # Upload all NAR files (with some parallelism).
-          # As mkBinaryCache produces them xz-compressed, unpack them on the fly.
-          # nar-bridge doesn't care about the path we upload *to*, but a
-          # subsequent .narinfo upload need to refer to its contents (by narhash).
-          echo -e "Uploading NARs… "
-          ls -d $to_upload/nar/*.nar.xz | parallel 'xz -d < {} | curl -s -T - --unix-socket $PWD/nar-bridge.sock http://localhost:9000/nar/$(basename {} | cut -d "." -f 1).nar'
-          echo "Done."
-
-          # Upload all NARInfo files.
-          # FUTUREWORK: This doesn't upload them in order, and currently relies
-          # on PathInfoService not doing any checking.
-          # In the future, we might want to make this behaviour configurable,
-          # and disable checking here, to keep the logic simple.
-          ls -d $to_upload/*.narinfo | parallel 'curl -s -T - --unix-socket $PWD/nar-bridge.sock http://localhost:9000/$(basename {}) < {}'
+          echo "Copying closure ${path}…"
+          # This picks up the `closure` key in `$NIX_ATTRS_JSON_FILE` automatically.
+          tvix-store --otlp=false copy
         '' + ''
           # Invoke a VM using tvix as the backing store, ensure the outpath appears in its listing.