From 3196fe0143b6ff729c177fa5d17fa03c9e9627c9 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Fri, 3 Nov 2023 13:34:37 +0200 Subject: refactor(tvix): move tvix glue code into glue crate There's various bits and pieces in tvix-cli that use both the store and evaluator, as well as nix-compat. For example, builtins.derivation, as well as the reference scanning implementation. This "glue code" currently isn't accessible from anywhere else, but it'd be very useful if it were. Move it out into a `glue` crate, and make `tvix-cli` a consumer of it. All the KnownPaths setup and passing around, as well as NIX_PATH handling is also something that should probably be moved into the glue crate as well, but that's something left for a future CL. Change-Id: I080ed3d1825ab23790666486840f301f00856277 Reviewed-on: https://cl.tvl.fyi/c/depot/+/9908 Autosubmit: flokli Tested-by: BuildkiteCI Reviewed-by: raitobezarius --- tvix/Cargo.nix | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) (limited to 'tvix/Cargo.nix') diff --git a/tvix/Cargo.nix b/tvix/Cargo.nix index dab411ebb863..ad3eac33b665 100644 --- a/tvix/Cargo.nix +++ b/tvix/Cargo.nix @@ -93,6 +93,16 @@ rec { # File a bug if you depend on any for non-debug work! debug = internal.debugCrate { inherit packageId; }; }; + "tvix-glue" = rec { + packageId = "tvix-glue"; + build = internal.buildRustCrateWithFeatures { + packageId = "tvix-glue"; + }; + + # Debug support which might change between releases. + # File a bug if you depend on any for non-debug work! + debug = internal.debugCrate { inherit packageId; }; + }; "tvix-serde" = rec { packageId = "tvix-serde"; build = internal.buildRustCrateWithFeatures { @@ -8730,6 +8740,10 @@ rec { name = "tvix-eval"; packageId = "tvix-eval"; } + { + name = "tvix-glue"; + packageId = "tvix-glue"; + } { name = "tvix-store"; packageId = "tvix-store"; @@ -8920,6 +8934,63 @@ rec { } ]; + }; + "tvix-glue" = rec { + crateName = "tvix-glue"; + version = "0.1.0"; + edition = "2021"; + # We can't filter paths with references in Nix 2.4 + # See https://github.com/NixOS/nix/issues/5410 + src = + if ((lib.versionOlder builtins.nixVersion "2.4pre20211007") || (lib.versionOlder "2.5" builtins.nixVersion)) + then lib.cleanSourceWith { filter = sourceFilter; src = ./glue; } + else ./glue; + dependencies = [ + { + name = "bytes"; + packageId = "bytes"; + } + { + name = "nix-compat"; + packageId = "nix-compat"; + } + { + name = "thiserror"; + packageId = "thiserror"; + } + { + name = "tokio"; + packageId = "tokio"; + } + { + name = "tracing"; + packageId = "tracing"; + } + { + name = "tvix-castore"; + packageId = "tvix-castore"; + } + { + name = "tvix-eval"; + packageId = "tvix-eval"; + } + { + name = "tvix-store"; + packageId = "tvix-store"; + usesDefaultFeatures = false; + } + { + name = "wu-manber"; + packageId = "wu-manber"; + } + ]; + devDependencies = [ + { + name = "test-case"; + packageId = "test-case"; + } + ]; + }; "tvix-serde" = rec { crateName = "tvix-serde"; -- cgit 1.4.1