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

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.

Shared Nix builderCommon build logic
Windows execution
A build
Another Nix operation
Builds can invoke further builds
The shared builder is integrated. The link to the public Windows implementation and the separate validation harness show which later steps were exercised.
  1. 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.

  2. 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.
  3. 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.

  4. 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.
  5. 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.

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

Available in public branch

The 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

Integrated

Unix 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 branch

Windows 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.