feat(tvix/cli): bundle corepkgs/fetchurl.nix with tvix-cli
This file which ships with C++ Nix is required for evaluating nixpkgs. Like C++ Nix, we now inject a pseudo path in EvalIO from which this will resolve as <nix/fetchurl.nix> Change-Id: Ic948c476a2cfc6381d5655d308bc2d5fa25b7123 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8213 Reviewed-by: raitobezarius <tvl@lahfa.xyz> Tested-by: BuildkiteCI
This commit is contained in:
parent
c700776733
commit
a59e264457
3 changed files with 76 additions and 1 deletions
|
|
@ -59,10 +59,24 @@ impl EvalIO for NixCompatIO {
|
|||
|
||||
// Pass the rest of the functions through to `Self::underlying`
|
||||
fn path_exists(&self, path: PathBuf) -> Result<bool, ErrorKind> {
|
||||
if path.starts_with("/__corepkgs__") {
|
||||
return Ok(true);
|
||||
}
|
||||
|
||||
self.underlying.path_exists(path)
|
||||
}
|
||||
|
||||
fn read_to_string(&self, path: PathBuf) -> Result<String, ErrorKind> {
|
||||
// Bundled version of corepkgs/fetchurl.nix. This workaround
|
||||
// is similar to what cppnix does for passing the path
|
||||
// through.
|
||||
//
|
||||
// TODO: this comparison is bad and allocates, we should use
|
||||
// the sane path library.
|
||||
if path.starts_with("/__corepkgs__/fetchurl.nix") {
|
||||
return Ok(include_str!("fetchurl.nix").to_string());
|
||||
}
|
||||
|
||||
self.underlying.read_to_string(path)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue