feat(tvix/nix-compat-derive): Add deriver for NixDeserialize

This adds a nix-compat-derive derive crate that implements a deriver
for NixDeserialize implementations. This is to reduce the amount of
code needed to implement deserialization for all the types used by
the Nix daemon protocol.

Change-Id: I484724b550e8a1d5e9adad9555d9dc1374ae95c2
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12022
Autosubmit: Brian Olsen <me@griff.name>
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
This commit is contained in:
Brian Olsen 2024-07-22 16:51:42 +02:00 committed by clbot
parent 9af6920478
commit ced05a2bb6
48 changed files with 2376 additions and 3 deletions

View file

@ -55,6 +55,26 @@ rec {
# File a bug if you depend on any for non-debug work!
debug = internal.debugCrate { inherit packageId; };
};
"nix-compat-derive" = rec {
packageId = "nix-compat-derive";
build = internal.buildRustCrateWithFeatures {
packageId = "nix-compat-derive";
};
# Debug support which might change between releases.
# File a bug if you depend on any for non-debug work!
debug = internal.debugCrate { inherit packageId; };
};
"nix-compat-derive-tests" = rec {
packageId = "nix-compat-derive-tests";
build = internal.buildRustCrateWithFeatures {
packageId = "nix-compat-derive-tests";
};
# 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-build" = rec {
packageId = "tvix-build";
build = internal.buildRustCrateWithFeatures {
@ -7395,6 +7415,12 @@ rec {
name = "mimalloc";
packageId = "mimalloc";
}
{
name = "nix-compat-derive";
packageId = "nix-compat-derive";
optional = true;
usesDefaultFeatures = false;
}
{
name = "nom";
packageId = "nom";
@ -7488,12 +7514,115 @@ rec {
features = {
"async" = [ "tokio" ];
"bytes" = [ "dep:bytes" ];
"default" = [ "async" "wire" ];
"default" = [ "async" "wire" "nix-compat-derive" ];
"nix-compat-derive" = [ "dep:nix-compat-derive" ];
"pin-project-lite" = [ "dep:pin-project-lite" ];
"tokio" = [ "dep:tokio" ];
"wire" = [ "tokio" "pin-project-lite" "bytes" ];
};
resolvedDefaultFeatures = [ "async" "bytes" "default" "pin-project-lite" "tokio" "wire" ];
resolvedDefaultFeatures = [ "async" "bytes" "default" "nix-compat-derive" "pin-project-lite" "test" "tokio" "wire" ];
};
"nix-compat-derive" = rec {
crateName = "nix-compat-derive";
version = "0.1.0";
edition = "2021";
src = lib.cleanSourceWith { filter = sourceFilter; src = ./nix-compat-derive; };
procMacro = true;
libName = "nix_compat_derive";
dependencies = [
{
name = "proc-macro2";
packageId = "proc-macro2";
features = [ "proc-macro" ];
}
{
name = "quote";
packageId = "quote";
features = [ "proc-macro" ];
}
{
name = "syn";
packageId = "syn 2.0.72";
features = [ "full" "extra-traits" ];
}
];
devDependencies = [
{
name = "hex-literal";
packageId = "hex-literal";
}
{
name = "nix-compat";
packageId = "nix-compat";
usesDefaultFeatures = false;
features = [ "async" "wire" "test" ];
}
{
name = "pretty_assertions";
packageId = "pretty_assertions";
}
{
name = "rstest";
packageId = "rstest";
}
{
name = "tokio";
packageId = "tokio";
features = [ "io-util" "macros" ];
}
{
name = "tokio-test";
packageId = "tokio-test";
}
];
features = {
"default" = [ "external" ];
};
resolvedDefaultFeatures = [ "default" "external" ];
};
"nix-compat-derive-tests" = rec {
crateName = "nix-compat-derive-tests";
version = "0.1.0";
edition = "2021";
src = lib.cleanSourceWith { filter = sourceFilter; src = ./nix-compat-derive-tests; };
devDependencies = [
{
name = "hex-literal";
packageId = "hex-literal";
}
{
name = "nix-compat";
packageId = "nix-compat";
features = [ "test" "wire" ];
}
{
name = "nix-compat-derive";
packageId = "nix-compat-derive";
}
{
name = "pretty_assertions";
packageId = "pretty_assertions";
}
{
name = "rstest";
packageId = "rstest";
}
{
name = "tokio";
packageId = "tokio";
features = [ "io-util" "macros" ];
}
{
name = "tokio-test";
packageId = "tokio-test";
}
{
name = "trybuild";
packageId = "trybuild";
}
];
features = { };
resolvedDefaultFeatures = [ "compile-tests" ];
};
"nohash-hasher" = rec {
crateName = "nohash-hasher";
@ -15498,6 +15627,45 @@ rec {
];
};
"trybuild" = rec {
crateName = "trybuild";
version = "1.0.99";
edition = "2021";
sha256 = "1s4i2hpyb66676xkg6b6fxm2qdsawj5lfad8ds68vgn46q6sayi0";
authors = [
"David Tolnay <dtolnay@gmail.com>"
];
dependencies = [
{
name = "glob";
packageId = "glob";
}
{
name = "serde";
packageId = "serde";
}
{
name = "serde_derive";
packageId = "serde_derive";
}
{
name = "serde_json";
packageId = "serde_json";
}
{
name = "termcolor";
packageId = "termcolor";
}
{
name = "toml";
packageId = "toml 0.8.15";
}
];
features = {
"diff" = [ "dissimilar" ];
"dissimilar" = [ "dep:dissimilar" ];
};
};
"tvix-build" = rec {
crateName = "tvix-build";
version = "0.1.0";