# How Nix enables deterministic debugging of race conditions

DevFeed: [How Nix enables deterministic debugging of race conditions](<https://devfeed.tech/articles/nix-wrote-half-of-my-debugger-76908.md>)

Original publisher: [Read original article](<https://fzakaria.com/2026/10/07/nix-wrote-half-of-my-debugger>)

Published: 2026-10-07T19:00:00Z

Content type: article

Language: en

Sources: [Farid Zakaria's Blog](<https://devfeed.tech/sources/farid-zakaria-s-blog.md>)

Topics: [Nix](<https://devfeed.tech/topics/nix.md>), [gdb](<https://devfeed.tech/topics/gdb.md>), [race-condition](<https://devfeed.tech/topics/race-condition.md>), [Deadlock](<https://devfeed.tech/topics/deadlock.md>)

Tags: [debugger](<https://devfeed.tech/tags/debugger.md>), [nix](<https://devfeed.tech/tags/nix.md>), [race-condition](<https://devfeed.tech/tags/race-condition.md>)

## AI overview

The author describes Rewind, a debugger built around Nix derivations and a deterministic virtual machine. Rewind can replay builds, vary thread schedules to find race conditions, compare runs, and inspect program state with gdb. Nix supplies reproducible inputs, sources, and debug symbols for the debugging workflow.

## Source excerpt

A few days ago I wrote about Rewind VM, a deterministic VM where every run of a Nix build is a pure function of its inputs, thread schedule included! I have been using it to find, reproduce and solve numerous race conditions in Nix builds, but it's been making me feel a little crazy. What is this superpower, and why is nobody else using it? The tool has quickly grown a source panel, stack frames, bookmarks, a "Compare" tab, a lot more gdb support, thread lanes, which show who held the CPU at every step, and "Check from here", which helps find the exact step where a race condition happens. I went into each new feature thinking it would be a big code-lift but I kept running into the same thing: the hard part of each feature was already done, and Nix had done it. A debugger for instance, needs the exact inputs of the program, its debug symbols, its sources, the sources of every library under it, and a way for someone else to get all of that on their machine. That's exactly what a derivation is, and Nix makes that easy.