about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--tvix/Cargo.lock16
-rw-r--r--tvix/Cargo.nix66
-rw-r--r--tvix/Cargo.toml1
-rw-r--r--tvix/cli/Cargo.toml1
-rw-r--r--tvix/derivation/Cargo.toml2
-rw-r--r--tvix/derivation/src/derivation.rs4
-rw-r--r--tvix/derivation/src/errors.rs2
-rw-r--r--tvix/derivation/src/output.rs2
-rw-r--r--tvix/derivation/src/tests/mod.rs2
-rw-r--r--tvix/derivation/src/validate.rs2
-rw-r--r--tvix/nix-compat/Cargo.toml16
-rw-r--r--tvix/nix-compat/default.nix5
-rw-r--r--tvix/nix-compat/src/lib.rs2
-rw-r--r--tvix/nix-compat/src/nixbase32.rs (renamed from tvix/store/src/nixbase32.rs)0
-rw-r--r--tvix/nix-compat/src/store_path.rs (renamed from tvix/store/src/store_path.rs)0
-rw-r--r--tvix/store/Cargo.toml3
-rw-r--r--tvix/store/src/lib.rs2
-rw-r--r--tvix/store/src/proto.rs2
-rw-r--r--tvix/store/src/sled_path_info_service.rs2
-rw-r--r--tvix/store/src/tests/pathinfo.rs6
20 files changed, 109 insertions, 27 deletions
diff --git a/tvix/Cargo.lock b/tvix/Cargo.lock
index 7519a5266092..46915411cba4 100644
--- a/tvix/Cargo.lock
+++ b/tvix/Cargo.lock
@@ -1302,6 +1302,18 @@ dependencies = [
 ]
 
 [[package]]
+name = "nix-compat"
+version = "0.1.0"
+dependencies = [
+ "anyhow",
+ "data-encoding",
+ "glob",
+ "sha2 0.10.6",
+ "test-case",
+ "thiserror",
+]
+
+[[package]]
 name = "nom8"
 version = "0.2.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2617,7 +2629,6 @@ dependencies = [
  "thiserror",
  "tvix-derivation",
  "tvix-eval",
- "tvix-store-bin",
 ]
 
 [[package]]
@@ -2627,13 +2638,13 @@ dependencies = [
  "anyhow",
  "data-encoding",
  "glob",
+ "nix-compat",
  "serde",
  "serde_json",
  "sha2 0.10.6",
  "test-case",
  "test-generator",
  "thiserror",
- "tvix-store-bin",
 ]
 
 [[package]]
@@ -2699,6 +2710,7 @@ dependencies = [
  "data-encoding",
  "fastcdc",
  "lazy_static",
+ "nix-compat",
  "prost",
  "prost-build",
  "sled",
diff --git a/tvix/Cargo.nix b/tvix/Cargo.nix
index e0895ac928fa..aa9fa9dbf84b 100644
--- a/tvix/Cargo.nix
+++ b/tvix/Cargo.nix
@@ -43,6 +43,16 @@ rec {
       # File a bug if you depend on any for non-debug work!
       debug = internal.debugCrate { inherit packageId; };
     };
+    "nix-compat" = rec {
+      packageId = "nix-compat";
+      build = internal.buildRustCrateWithFeatures {
+        packageId = "nix-compat";
+      };
+
+      # 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-cli" = rec {
       packageId = "tvix-cli";
       build = internal.buildRustCrateWithFeatures {
@@ -3725,6 +3735,46 @@ rec {
         features = { };
         resolvedDefaultFeatures = [ "integration_tests" ];
       };
+      "nix-compat" = rec {
+        crateName = "nix-compat";
+        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 = ./nix-compat; }
+          else ./nix-compat;
+        dependencies = [
+          {
+            name = "anyhow";
+            packageId = "anyhow";
+          }
+          {
+            name = "data-encoding";
+            packageId = "data-encoding";
+          }
+          {
+            name = "glob";
+            packageId = "glob";
+          }
+          {
+            name = "sha2";
+            packageId = "sha2 0.10.6";
+          }
+          {
+            name = "thiserror";
+            packageId = "thiserror";
+          }
+        ];
+        devDependencies = [
+          {
+            name = "test-case";
+            packageId = "test-case";
+          }
+        ];
+
+      };
       "nom8" = rec {
         crateName = "nom8";
         version = "0.2.0";
@@ -7745,10 +7795,6 @@ rec {
             name = "tvix-eval";
             packageId = "tvix-eval";
           }
-          {
-            name = "tvix-store-bin";
-            packageId = "tvix-store-bin";
-          }
         ];
 
       };
@@ -7776,6 +7822,10 @@ rec {
             packageId = "glob";
           }
           {
+            name = "nix-compat";
+            packageId = "nix-compat";
+          }
+          {
             name = "serde";
             packageId = "serde";
             features = [ "derive" ];
@@ -7788,10 +7838,6 @@ rec {
             name = "thiserror";
             packageId = "thiserror";
           }
-          {
-            name = "tvix-store-bin";
-            packageId = "tvix-store-bin";
-          }
         ];
         devDependencies = [
           {
@@ -8061,6 +8107,10 @@ rec {
             packageId = "lazy_static";
           }
           {
+            name = "nix-compat";
+            packageId = "nix-compat";
+          }
+          {
             name = "prost";
             packageId = "prost";
           }
diff --git a/tvix/Cargo.toml b/tvix/Cargo.toml
index 748b991ddfd1..b125a94ad57c 100644
--- a/tvix/Cargo.toml
+++ b/tvix/Cargo.toml
@@ -24,6 +24,7 @@ members = [
   "eval/builtin-macros",
   "nar",
   "nix_cli",
+  "nix-compat",
   "serde",
   "store",
 ]
diff --git a/tvix/cli/Cargo.toml b/tvix/cli/Cargo.toml
index 42d2102c4bb0..5bb7baa15864 100644
--- a/tvix/cli/Cargo.toml
+++ b/tvix/cli/Cargo.toml
@@ -12,7 +12,6 @@ tvix-eval = { path = "../eval" }
 tvix-derivation = { path = "../derivation" }
 rustyline = "10.0.0"
 clap = { version = "4.0", features = ["derive", "env"] }
-tvix-store-bin = { path = "../store" }
 dirs = "4.0.0"
 smol_str = "0.1"
 aho-corasick = "0.7"
diff --git a/tvix/derivation/Cargo.toml b/tvix/derivation/Cargo.toml
index ff54a0848abe..ee629b6ad3c3 100644
--- a/tvix/derivation/Cargo.toml
+++ b/tvix/derivation/Cargo.toml
@@ -9,10 +9,10 @@ edition = "2021"
 anyhow = "1.0.68"
 data-encoding = "2.3.3"
 glob = "0.3.0"
+nix-compat = { path = "../nix-compat" }
 serde = { version = "1.0", features = ["derive"] }
 sha2 = "0.10.6"
 thiserror = "1.0.38"
-tvix-store-bin = { path = "../store" }
 
 [dev-dependencies.test-generator]
 # This fork of test-generator adds support for cargo workspaces, see
diff --git a/tvix/derivation/src/derivation.rs b/tvix/derivation/src/derivation.rs
index 390024da33ee..d58fef13bcd7 100644
--- a/tvix/derivation/src/derivation.rs
+++ b/tvix/derivation/src/derivation.rs
@@ -1,12 +1,12 @@
 use crate::output::{Hash, Output};
 use crate::write;
 use crate::DerivationError;
+use nix_compat::nixbase32;
+use nix_compat::store_path::{StorePath, STORE_DIR};
 use serde::{Deserialize, Serialize};
 use sha2::{Digest, Sha256};
 use std::collections::BTreeSet;
 use std::{collections::BTreeMap, fmt, fmt::Write};
-use tvix_store::nixbase32;
-use tvix_store::store_path::{StorePath, STORE_DIR};
 
 #[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize)]
 pub struct Derivation {
diff --git a/tvix/derivation/src/errors.rs b/tvix/derivation/src/errors.rs
index cf7e65697e80..b07abfab5176 100644
--- a/tvix/derivation/src/errors.rs
+++ b/tvix/derivation/src/errors.rs
@@ -1,5 +1,5 @@
+use nix_compat::{nixbase32::Nixbase32DecodeError, store_path::ParseStorePathError};
 use thiserror::Error;
-use tvix_store::{nixbase32::Nixbase32DecodeError, store_path::ParseStorePathError};
 
 /// Errors that can occur during the validation of Derivation structs.
 #[derive(Debug, Error, PartialEq)]
diff --git a/tvix/derivation/src/output.rs b/tvix/derivation/src/output.rs
index ac5a7bcb6c2d..828f42be74ca 100644
--- a/tvix/derivation/src/output.rs
+++ b/tvix/derivation/src/output.rs
@@ -1,5 +1,5 @@
+use nix_compat::{nixbase32, store_path::StorePath};
 use serde::{Deserialize, Serialize};
-use tvix_store::{nixbase32, store_path::StorePath};
 
 use crate::OutputError;
 
diff --git a/tvix/derivation/src/tests/mod.rs b/tvix/derivation/src/tests/mod.rs
index 644e0685d735..2906bae1f76a 100644
--- a/tvix/derivation/src/tests/mod.rs
+++ b/tvix/derivation/src/tests/mod.rs
@@ -1,12 +1,12 @@
 use crate::derivation::Derivation;
 use crate::output::{Hash, Output};
+use nix_compat::store_path::StorePath;
 use std::collections::BTreeSet;
 use std::fs::File;
 use std::io::Read;
 use std::path::Path;
 use test_case::test_case;
 use test_generator::test_resources;
-use tvix_store::store_path::StorePath;
 
 const RESOURCES_PATHS: &str = "src/tests/derivation_tests";
 
diff --git a/tvix/derivation/src/validate.rs b/tvix/derivation/src/validate.rs
index 09b9eea415e5..05f1e1ad713b 100644
--- a/tvix/derivation/src/validate.rs
+++ b/tvix/derivation/src/validate.rs
@@ -1,5 +1,5 @@
 use crate::{derivation::Derivation, DerivationError};
-use tvix_store::store_path::StorePath;
+use nix_compat::store_path::StorePath;
 
 impl Derivation {
     /// validate ensures a Derivation struct is properly populated,
diff --git a/tvix/nix-compat/Cargo.toml b/tvix/nix-compat/Cargo.toml
new file mode 100644
index 000000000000..484285e78063
--- /dev/null
+++ b/tvix/nix-compat/Cargo.toml
@@ -0,0 +1,16 @@
+[package]
+name = "nix-compat"
+version = "0.1.0"
+edition = "2021"
+
+# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+
+[dependencies]
+anyhow = "1.0.68"
+data-encoding = "2.3.3"
+glob = "0.3.0"
+sha2 = "0.10.6"
+thiserror = "1.0.38"
+
+[dev-dependencies]
+test-case = "2.2.2"
diff --git a/tvix/nix-compat/default.nix b/tvix/nix-compat/default.nix
new file mode 100644
index 000000000000..7f51438eb70d
--- /dev/null
+++ b/tvix/nix-compat/default.nix
@@ -0,0 +1,5 @@
+{ depot, ... }:
+
+depot.tvix.crates.workspaceMembers.nix-compat.build.override {
+  runTests = true;
+}
diff --git a/tvix/nix-compat/src/lib.rs b/tvix/nix-compat/src/lib.rs
new file mode 100644
index 000000000000..6ca48e9ef035
--- /dev/null
+++ b/tvix/nix-compat/src/lib.rs
@@ -0,0 +1,2 @@
+pub mod nixbase32;
+pub mod store_path;
diff --git a/tvix/store/src/nixbase32.rs b/tvix/nix-compat/src/nixbase32.rs
index 39aa4f1d5461..39aa4f1d5461 100644
--- a/tvix/store/src/nixbase32.rs
+++ b/tvix/nix-compat/src/nixbase32.rs
diff --git a/tvix/store/src/store_path.rs b/tvix/nix-compat/src/store_path.rs
index 5032a73fb19b..5032a73fb19b 100644
--- a/tvix/store/src/store_path.rs
+++ b/tvix/nix-compat/src/store_path.rs
diff --git a/tvix/store/Cargo.toml b/tvix/store/Cargo.toml
index 151d985c82eb..769b496235d6 100644
--- a/tvix/store/Cargo.toml
+++ b/tvix/store/Cargo.toml
@@ -14,9 +14,10 @@ lazy_static = "1.4.0"
 clap = { version = "4.0", features = ["derive", "env"] }
 prost = "0.11.2"
 sled = { version = "0.34.7", features = ["compression"] }
+nix-compat = { path = "../nix-compat" }
 thiserror = "1.0.38"
-tokio = { version = "1.23.0", features = ["rt-multi-thread"] }
 tokio-stream = "0.1.11"
+tokio = { version = "1.23.0", features = ["rt-multi-thread"] }
 tonic = "0.8.2"
 tracing-subscriber = "0.3.16"
 tracing = "0.1.37"
diff --git a/tvix/store/src/lib.rs b/tvix/store/src/lib.rs
index d0e505733a74..2c7f4887ce9f 100644
--- a/tvix/store/src/lib.rs
+++ b/tvix/store/src/lib.rs
@@ -1,6 +1,4 @@
-pub mod nixbase32;
 pub mod proto;
-pub mod store_path;
 
 pub mod dummy_blob_service;
 pub mod sled_directory_service;
diff --git a/tvix/store/src/proto.rs b/tvix/store/src/proto.rs
index 0c4a894c23b5..fc5db4446d5e 100644
--- a/tvix/store/src/proto.rs
+++ b/tvix/store/src/proto.rs
@@ -5,7 +5,7 @@ use thiserror::Error;
 
 use prost::Message;
 
-use crate::store_path::{ParseStorePathError, StorePath};
+use nix_compat::store_path::{ParseStorePathError, StorePath};
 
 tonic::include_proto!("tvix.store.v1");
 
diff --git a/tvix/store/src/sled_path_info_service.rs b/tvix/store/src/sled_path_info_service.rs
index 3215fd0e4730..6b9212a3c912 100644
--- a/tvix/store/src/sled_path_info_service.rs
+++ b/tvix/store/src/sled_path_info_service.rs
@@ -7,7 +7,7 @@ use crate::proto::CalculateNarResponse;
 use crate::proto::GetPathInfoRequest;
 use crate::proto::Node;
 use crate::proto::PathInfo;
-use crate::store_path::DIGEST_SIZE;
+use nix_compat::store_path::DIGEST_SIZE;
 use tonic::{Request, Response, Result, Status};
 use tracing::{instrument, warn};
 
diff --git a/tvix/store/src/tests/pathinfo.rs b/tvix/store/src/tests/pathinfo.rs
index a278cf5e8eb0..35a2771c300a 100644
--- a/tvix/store/src/tests/pathinfo.rs
+++ b/tvix/store/src/tests/pathinfo.rs
@@ -1,8 +1,6 @@
-use crate::{
-    proto::{self, Node, PathInfo, ValidatePathInfoError},
-    store_path::{ParseStorePathError, StorePath},
-};
+use crate::proto::{self, Node, PathInfo, ValidatePathInfoError};
 use lazy_static::lazy_static;
+use nix_compat::store_path::{ParseStorePathError, StorePath};
 use test_case::test_case;
 
 lazy_static! {