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 <flokli@flokli.de>
Tested-by: BuildkiteCI
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
This commit is contained in:
Florian Klink 2023-11-03 13:34:37 +02:00 committed by clbot
parent a51d277764
commit 3196fe0143
17 changed files with 154 additions and 22 deletions

View file

@ -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";