Nix on Windows
Windows support in testable steps.
The upstream foundation can execute a minimal Windows builder and cross-build the complete project. Public implementations extend that path through recursive builds, lossless filenames, network paths, and explicit process boundaries.
My decision. I split the Windows build path into steps so reviewers could test each one on its own.
Nix merged my minimal Windows builder in #16347. The wider runtime, including recursive builds, is usable in my public fork.
Inspect the minimal Windows builder in Nix PR #16347 (opens in a new tab)Inspect recursive builds in the public fork (opens in a new tab)Link to this passage- Who this helps
- Infrastructure and developer-platform teams bringing reproducible builds across operating-system boundaries.
- My role
- I built and validated the Windows execution path in independently testable stages, from the first builder through project-wide cross-builds and recursive operation.
- Current state
- The Windows builder foundation and portable process-handle inheritance are integrated upstream. The wider runtime is available in the linked public fork and branches.
- Public activity
- Public contribution activity · 2026
Other changes in this project
Other changes in this project
On GitHubOpen project: NixOS/nix (opens in a new tab)
Nix #16347: the minimal Windows builderRead the reviewed change (opens in a new tab)The upstream review and implementation of the first builder are linked here.
NixOS/nix
Nix #16449: which handles a child process inheritsRead the reviewed change (opens in a new tab)The review covers handle inheritance across platforms. The commit below is a smaller namespace edit in that review.
How it works / 06 stages
From constraint to a system a team can own.
Six stages connect the original pressure to the system that now exists.
Extend the builder. Keep the shared structure.
Pressure
A new platform exposes every hidden assumption.
Nix’s model depends on stable store paths, isolated builders, deterministic references, and explicit process boundaries. Bringing those semantics across the Windows portability boundary means more than making the code compile. The useful result is a build path whose outputs and failure modes remain understandable under a different process, filesystem, and toolchain model.
See the starting point (opens in a new tab)More links from this decision
Constraint
Windows support must preserve Nix semantics.
The Windows implementation sits inside a large, portable C++ system. Process creation, handle inheritance, path behavior, executable discovery, daemon communication, store semantics, content-addressed outputs, and cross-compilation all meet at boundaries already relied on by other platforms. Each step needs a narrow seam and a result that can be checked independently.
- Keep platform hooks narrow and preserve common builder logic.
- Cross-build every Windows component so unvisited code cannot silently drift.
- Validate produced results separately from the build that created them.
Decision
Advance through narrow portability seams.
The implementation separates a minimal derivation builder, project-wide cross-build coverage, libstore and output semantics, and recursive operation. Each layer can move independently without making the complete capability wait on one large integration step. A separate public validation project checks build results instead of allowing the implementation to grade its own output.
Implementation
Extend the path from derivation execution to recursive Nix.
The Windows path adds a minimal derivation builder and brings every project component into the cross-build graph. It turns libstore tests into a meaningful gate, enables content-addressed and fixed-output derivations, restores evaluator startup in the validation environment, and lifts recursive Nix into the shared builder with focused platform hooks.
- Execute derivations through the shared builder contract.
- Bring complete Windows components into the cross-build graph.
- Exercise libstore and recursive operation with independent output checks.
- Preserve Windows filenames and network-share roots without losing characters during conversion.
- Make process-handle inheritance portable and reject network-isolation options that have no implemented backend.
- Coordinate recursive-build shutdown across listening sockets, connected clients, and worker threads.
Inspect the build (opens in a new tab)More links from this decision
- Nix #16368, whole-project Windows cross-build (opens in a new tab)
- Nix #16411, Windows libstore gate and output semantics (opens in a new tab)
- Nix #16414, recursive Nix on Windows (opens in a new tab)
- Nix #16449, portable process handle inheritance (opens in a new tab)
- Nix #16451, lossless Windows filenames and network paths (opens in a new tab)
- Nix #16453, explicit Windows network-isolation contract (opens in a new tab)
- Nix, coordinated recursive-build shutdown (opens in a new tab)
- Nix, Windows socket conversion and inheritance (opens in a new tab)
- Nix Windows validation harness #1 (opens in a new tab)
State
Windows now has an upstream foundation and a usable wider runtime.
The Windows derivation builder, complete cross-build coverage, and portable process-handle inheritance are integrated upstream. Public branches extend that foundation with libstore checks, richer output semantics, recursive operation, and lossless filenames. An independent validation harness checks the resulting build path.
See where it works (opens in a new tab)More links from this decision
- Nix #16368, whole-project Windows cross-build (opens in a new tab)
- Nix #16411, Windows libstore gate and output semantics (opens in a new tab)
- Nix #16414, recursive Nix on Windows (opens in a new tab)
- Nix #16449, portable process handle inheritance (opens in a new tab)
- Nix #16451, lossless Windows filenames and network paths (opens in a new tab)
- Nix Windows libstore implementation (opens in a new tab)
- Nix recursive Windows implementation (opens in a new tab)
Source
Inspect the builder, runtime, and independent result checks.
The linked pull requests connect each Windows capability to its implementation and tests. The Windows libstore and recursive-operation links lead to their specific implementations. Nix's upstream foundation and the independent validation harness are linked separately.
Follow the public work (opens in a new tab)More links from this decision
- Nix #16347, Windows derivation builder (opens in a new tab)
- Nix #16368, whole-project Windows cross-build (opens in a new tab)
- Nix #16411, Windows libstore gate and output semantics (opens in a new tab)
- Nix #16414, recursive Nix on Windows (opens in a new tab)
- Nix #16449, portable process handle inheritance (opens in a new tab)
- Nix #16451, lossless Windows filenames and network paths (opens in a new tab)
- Nix, coordinated recursive-build shutdown (opens in a new tab)
- Nix, Windows socket conversion and inheritance (opens in a new tab)
- Nix Windows validation harness #1 (opens in a new tab)
- Nix Windows libstore implementation (opens in a new tab)
- Nix recursive Windows implementation (opens in a new tab)
Public work / Implementation trail
Inspect the work behind the result.
Open the working code, review discussions, exact changes, and documentation behind each part.
I've written about this work on LinkedIn as well: Bringing a Windows builder into the build graph, on LinkedIn, opens in a new tab follows the build example from cmd.exe to a registered executable in the store; Windows paths need more than separator replacement, on LinkedIn, opens in a new tab covers drives, UNC shares and device roots; and a shorter post on the setEnv fix asks what becomes possible when a return convention aligns cleanly across callers, on LinkedIn, opens in a new tab.
What changed
IntegratedA minimal Windows derivation builder and whole-project cross-build coverage are available upstream.
Implemented
Where this work lives
- Available now
- Available in the upstream Nix project.
- Integration
- Merged upstream in Nix #16347 and #16368.
- What supports it
- Build-path implementation backed by project-wide cross-build coverage.
What changed
Available in public branchThe Windows runtime extends through libstore assurance, content-addressed outputs, and recursive Nix.
Implemented
Where this work lives
- Available now
- Available in the public fork and linked pull-request branches.
- Integration
- Implemented in Nix #16411 and #16414 and available from the linked public fork.
- What supports it
- Validated through a separate Windows checking path.
What changed
IntegratedUnix and Windows callers share an explicit contract for which process handles a child inherits.
Implemented
Where this work lives
- Available now
- Available in the upstream Nix project.
- Integration
- Merged upstream in Nix #16449 on September 20, 2026.
- What supports it
- Portable closeOnExec handling with platform-specific implementations behind a common interface.
What changed
Available in public branchWindows filenames survive conversion intact, and recursive build connections have coordinated shutdown.
Implemented
Where this work lives
- Available now
- Available in the linked public implementation branches.
- Integration
- Implemented in Nix #16451 and the linked public revisions; #16453 defines the network-isolation settings contract.
- What supports it
- Focused path and process tests. Network-isolation settings reject unsupported backends; they do not implement a Windows sandbox.
Continue exploring
Compare the decisions across systems.
Move to another result, or return to the complete work collection.