Story Details

  • Is NixOS truly reproducible?

    Posted: 2025-02-09 09:56:13

    NixOS aims for reproducibility, but subtle discrepancies can arise. While package builds are generally deterministic thanks to Nix's controlled environment, issues like differing system times during builds, non-deterministic build processes within packages themselves, and reliance on external resources like network-fetched timestamps or random numbers can introduce variability. The author highlights these challenges and explores how they impact reproducibility in practice, demonstrating that while NixOS significantly improves build consistency, achieving perfect reproducibility requires careful attention and sometimes impractical restrictions. Flaky tests and varying build outputs are presented as evidence of these limitations, showcasing scenarios where identical Nix expressions produce different results.

    Summary of Comments ( 94 )
    https://news.ycombinator.com/item?id=42989666

    Hacker News users discuss reproducibility issues encountered with NixOS, despite its declarative nature. Several commenters point out that while Nix excels at package reproducibility, issues arise from external factors like hardware differences (particularly GPUs and networking) and reliance on non-reproducible external resources like timestamps and random number generation. One compelling comment highlights the distinction between "build reproducibility" and "runtime reproducibility," arguing NixOS effectively achieves the former but struggles with the latter. Others suggest that focusing solely on bit-for-bit reproducibility is misplaced, and that NixOS's value lies in its robust declarative configuration and ease of rollback, even if perfect reproducibility remains a challenge. The importance of properly caching build dependencies for true reproducibility is also emphasized. Several users share anecdotal experiences with inconsistencies and difficulties reproducing specific configurations, especially when dealing with complex setups or proprietary drivers.