Nix as a Mario Emulator: Infinite Attribute Trees and 20,000-Button Runs

Super Mario Derivations

Nix as a Mario Emulator: Infinite Attribute Trees and 20,000-Button Runs

The Nix language's laziness lets attribute sets contain themselves, enabling infinite recursion. This blog post explores that by turning attribute paths into button sequences for Super Mario Bros. 3, where each press is a derivation. The result: a store that acts as a savestate history, with branching costing almost nothing. The author pushes limits, reaching 20,000 presses before hitting OS argument limits, and shows how the store becomes a reproducible state-machine.

The dependency graph _is_ the input sequence, so we can ask Nix what buttons produced a frame.

More from this day

2026-08-14