From 8181817e53f4c0da5d7dfa1a56e296fefd929bcb Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Mon, 22 Apr 2024 20:05:49 +0300 Subject: feat(tvix/glue/fetchers): support file:// URLs Nix supports file:// - URLs for `fetchurl` and `fetchTarball`. Convert the enums and function arguments to hold a URL type. reqwest::Url is a re-export of the url crate, but they don't re-export the parsing errors, and as we want to hold these in our Error types, add it to Cargo.toml explicitly. The Fetcher::download function now checks on the scheme, and either opens the file locally, or does do a HTTP request as before. Fetch gets its custom debug impl, removing potentially sensitive username and password out of URLs. Change-Id: I777db1fe487370e822cbfec4624034aca5e08045 Reviewed-on: https://cl.tvl.fyi/c/depot/+/11504 Autosubmit: flokli Reviewed-by: raitobezarius Tested-by: BuildkiteCI --- tvix/glue/src/tests/tvix_tests/eval-okay-fetchurl.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'tvix/glue/src/tests/tvix_tests/eval-okay-fetchurl.nix') diff --git a/tvix/glue/src/tests/tvix_tests/eval-okay-fetchurl.nix b/tvix/glue/src/tests/tvix_tests/eval-okay-fetchurl.nix index 80fe808c21..8a39101525 100644 --- a/tvix/glue/src/tests/tvix_tests/eval-okay-fetchurl.nix +++ b/tvix/glue/src/tests/tvix_tests/eval-okay-fetchurl.nix @@ -1,6 +1,8 @@ [ - # (fetchurl "url") cannot be tested, as that one has to fetch from the - # internet to calculate the path. + # (fetchurl "url") needs to immediately fetch, but our options without + # internet access are fairly limited. + # TODO: populate some fixtures at a known location instead. + (builtins.fetchurl "file:///dev/null") # fetchurl with url and sha256 (builtins.fetchurl { -- cgit 1.4.1