Module tvix_eval::io

source ·
Expand description

Interface for injecting I/O-related functionality into tvix-eval.

The Nix language contains several builtins (e.g. builtins.readDir), as well as language feature (e.g. string-“coercion” of paths) that interact with the filesystem.

The language evaluator implemented by this crate does not depend on any particular filesystem interaction model. Instead, this module provides a trait that can be implemented by tvix-eval callers to provide the functionality they desire.

In theory this can be used to implement “mocked” filesystem interactions, or interaction with remote filesystems, etc.

In the context of Nix builds, callers also use this interface to determine how store paths are opened and so on.


  • Dummy implementation of EvalIO, can be used in contexts where IO is not available but code should “pretend” that it is.
  • Implementation of EvalIO that simply uses the equivalent standard library functions, i.e. does local file-IO.


  • Types of files as represented by builtins.readDir in Nix.


  • Represents all possible filesystem interactions that exist in the Nix language, and that need to be executed somehow.