about summary refs log tree commit diff
path: root/tvix/Cargo.nix
diff options
context:
space:
mode:
authorJürgen Hahn <juergen_hahn@gmx.net>2022-12-28T09·28+0100
committerjrhahn <mail.jhahn@gmail.com>2022-12-29T14·38+0000
commitbb185b2c6eb8c4e035cddb61be772169df1b0139 (patch)
tree0598b8a1e26d98274c93f52d01b53291e59adb91 /tvix/Cargo.nix
parent42fe3941c2a02b4b1eb55dad4f83941a2708f77e (diff)
feat(tvix/derivation): serialize Nix Derivation r/5536
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
Diffstat (limited to 'tvix/Cargo.nix')
-rw-r--r--tvix/Cargo.nix61
1 files changed, 61 insertions, 0 deletions
diff --git a/tvix/Cargo.nix b/tvix/Cargo.nix
index 7d3c4c8691..fdc93f248b 100644
--- a/tvix/Cargo.nix
+++ b/tvix/Cargo.nix
@@ -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 {
@@ -1434,6 +1444,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";
         version = "0.1.13";
@@ -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";