feat(tvix/derivation): serialize Nix Derivation

This adds a Derivation structure and allows to write it to a structure that implements std::fmt:Write.
The implementation is based on the go-nix version.

Change-Id: Ib54e1202b5c67f5d206b21bc109a751e971064cf
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7659
Reviewed-by: flokli <flokli@flokli.de>
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
This commit is contained in:
Jürgen Hahn 2022-12-28 10:28:37 +01:00 committed by jrhahn
parent 42fe3941c2
commit bb185b2c6e
22 changed files with 516 additions and 0 deletions

View file

@ -33,6 +33,16 @@ rec {
# You can override the features with
# workspaceMembers."${crateName}".build.override { features = [ "default" "feature1" ... ]; }.
workspaceMembers = {
"derivation" = rec {
packageId = "derivation";
build = internal.buildRustCrateWithFeatures {
packageId = "derivation";
};
# 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-cli" = rec {
packageId = "nix-cli";
build = internal.buildRustCrateWithFeatures {
@ -1433,6 +1443,47 @@ rec {
}
];
};
"derivation" = rec {
crateName = "derivation";
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")
then lib.cleanSourceWith { filter = sourceFilter; src = ./derivation; }
else ./derivation;
dependencies = [
{
name = "blake3";
packageId = "blake3";
features = [ "rayon" "std" ];
}
{
name = "maplit";
packageId = "maplit";
}
{
name = "prost";
packageId = "prost";
}
{
name = "tonic";
packageId = "tonic";
}
];
buildDependencies = [
{
name = "prost-build";
packageId = "prost-build";
}
{
name = "tonic-build";
packageId = "tonic-build";
}
];
};
"diff" = rec {
crateName = "diff";
@ -2657,6 +2708,16 @@ rec {
"value-bag" = [ "dep:value-bag" ];
};
};
"maplit" = rec {
crateName = "maplit";
version = "1.0.2";
edition = "2015";
sha256 = "07b5kjnhrrmfhgqm9wprjw8adx6i225lqp49gasgqg74lahnabiy";
authors = [
"bluss"
];
};
"matchit" = rec {
crateName = "matchit";
version = "0.7.0";