about summary refs log tree commit diff
path: root/tvix/eval/src/builtins/mod.rs
diff options
context:
space:
mode:
authorAdam Joseph <adam@westernsemico.com>2023-12-12T07·34-0800
committerclbot <clbot@tvl.fyi>2023-12-12T17·20+0000
commit8d4aa2c15c88d6e2912882ebf480d89c172d4e1f (patch)
tree25a6d167857aac1772f5b098938bd4713974a02a /tvix/eval/src/builtins/mod.rs
parentbb1e79e5d19a43beeebe8f858019131c57f99c65 (diff)
fix(tvix/eval): add unimplemented __curPos and builtins.filterSource r/7193
This commit adds __curPos (to the global scope, yuck) and
builtins.filterSource.  These are not implemented; forcing them will
produce the same result as `throw "message"`.

Unfortunately these two post-2.3 features are used throughout
nixpkgs.  Since an unresolved indentifier is a catchable error, this
breaks the entire release eval.  With this commit, it simply causes
those broken packages that use these features to appear as they are:
broken.

Change-Id: Ib43dea571f6a9fab4d54869349f80ee4ec5424c2
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10297
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Autosubmit: Adam Joseph <adam@westernsemico.com>
Diffstat (limited to 'tvix/eval/src/builtins/mod.rs')
-rw-r--r--tvix/eval/src/builtins/mod.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/tvix/eval/src/builtins/mod.rs b/tvix/eval/src/builtins/mod.rs
index 62684b82453e..4bdce300a564 100644
--- a/tvix/eval/src/builtins/mod.rs
+++ b/tvix/eval/src/builtins/mod.rs
@@ -377,6 +377,15 @@ mod pure_builtins {
         toml::from_str(&toml_str).map_err(|err| err.into())
     }
 
+    #[builtin("filterSource")]
+    #[allow(non_snake_case)]
+    async fn builtin_filterSource(_co: GenCo, #[lazy] _e: Value) -> Result<Value, ErrorKind> {
+        // TODO: implement for nixpkgs compatibility
+        Ok(Value::Catchable(CatchableErrorKind::UnimplementedFeature(
+            "filterSource".to_string(),
+        )))
+    }
+
     #[builtin("genericClosure")]
     async fn builtin_generic_closure(co: GenCo, input: Value) -> Result<Value, ErrorKind> {
         let attrs = input.to_attrs()?;
@@ -1084,6 +1093,14 @@ pub fn pure_builtins() -> Vec<(&'static str, Value)> {
         crate::systems::llvm_triple_to_nix_double(CURRENT_PLATFORM).into(),
     ));
 
+    // TODO: implement for nixpkgs compatibility
+    result.push((
+        "__curPos",
+        Value::Catchable(CatchableErrorKind::UnimplementedFeature(
+            "__curPos".to_string(),
+        )),
+    ));
+
     result
 }