Skip to content

Commit bcc0ba3

Browse files
committed
feat(glue/builtins): implement builtins.fetchTree
- Add support for Nix flake references parsing and URL handling - Most of the implementation resides in the glue module for builtins - Preserve unrecognized URL parameters when extracting known parameters - Add comprehensive tests for URL handling - Fetch eagerly, but block on results only upon evaluating thunk Change-Id: Ibc09c98c24b470fa321459c9ee32f373454dd0ad
1 parent 8cd9a21 commit bcc0ba3

File tree

18 files changed

+3280
-767
lines changed

18 files changed

+3280
-767
lines changed

snix/Cargo.lock

Lines changed: 547 additions & 215 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

snix/Cargo.nix

Lines changed: 1413 additions & 316 deletions
Large diffs are not rendered by default.

snix/Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,10 @@ fastcdc = "3.1.0"
7272
fuse-backend-rs = "0.12.0"
7373
futures = "0.3.30"
7474
genawaiter = { version = "0.99.1", default-features = false }
75-
gix = "0.67.0"
75+
gix = "0.70.0"
76+
gix-transport = { version = "0.45.0", features = ["blocking-client"] }
77+
gix-protocol = "0.45.0"
78+
gix-url = "0.29.0"
7679
glob = "0.3.1"
7780
hex-literal = "0.4.1"
7881
http = "1.1.0"

snix/docs/src/eval/builtins.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ The `impl` column indicates implementation status in tvix:
130130
|---------------|--------|-------|-------|-------|
131131
| break | false | 1 | | todo |
132132
| ceil | false | 1 | true | |
133-
| fetchTree | true | 1 | | todo |
133+
| fetchTree | true | 1 | | |
134134
| floor | false | 1 | true | |
135135
| groupBy | false | 2 | true | |
136136
| traceVerbose | false | 2 | | todo |

snix/eval/src/value/thunk.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,11 @@ impl Thunk {
150150
})))
151151
}
152152

153+
#[doc(hidden)]
154+
/// Creates a thunk that, when forced, calls the given native function.
155+
///
156+
/// This is exposed for internal use by modules that need to create thunks
157+
/// that defer evaluation until forced.
153158
pub fn new_suspended_native(native: Box<dyn Fn() -> Result<Value, ErrorKind>>) -> Self {
154159
Thunk(Rc::new(RefCell::new(ThunkRepr::Native(SuspendedNative(
155160
native,

snix/glue/Cargo.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ chrono = "0.4.35"
1717
data-encoding.workspace = true
1818
futures.workspace = true
1919
magic.workspace = true
20+
gix.workspace = true
21+
gix-url.workspace = true
22+
gix-transport = { workspace = true, features = [
23+
"blocking-client",
24+
"http-client",
25+
] }
26+
gix-protocol = { workspace = true, features = ["blocking-client"] }
2027
nix-compat = { path = "../nix-compat", features = ["flakeref"] }
2128
pin-project.workspace = true
2229
reqwest = { workspace = true, features = ["rustls-tls-native-roots"] }
@@ -36,6 +43,7 @@ serde_json.workspace = true
3643
sha2.workspace = true
3744
sha1.workspace = true
3845
md-5.workspace = true
46+
tempfile.workspace = true
3947
url.workspace = true
4048
walkdir.workspace = true
4149
clap.workspace = true

0 commit comments

Comments
 (0)