Skip to main content

Module nix

Module nix 

Source
Expand description

Nix-based executor for synthesized stages.

Runs stage implementations as isolated subprocesses using nix run nixpkgs#<runtime>, giving us hermetic, reproducible execution without requiring any ambient language runtime.

§Execution protocol

  • stdin → JSON-encoded input value followed by a newline
  • stdout → JSON-encoded output value followed by a newline
  • stderr → error message (any content is treated as failure)
  • exit 0 → success; exit non-zero → ExecutionError::StageFailed

§Timeout

Every execution is bounded by NixConfig::timeout_secs (default 30 s). When the child process exceeds the limit it is sent SIGKILL and the call returns ExecutionError::TimedOut.

§Generated wrapper (Python example)

import sys, json as _json

# ---- user code ----
def execute(input_value):
    ...
# -------------------

if __name__ == '__main__':
    try:
        _output = execute(_json.loads(sys.stdin.read()))
        print(_json.dumps(_output))
    except Exception as e:
        print(str(e), file=sys.stderr)
        sys.exit(1)

Structs§

NixConfig
Tunable knobs for the NixExecutor.
NixExecutor
Executor that runs synthesized stages through Nix-managed language runtimes.