{"by":"hinshun","descendants":15,"id":43567701,"kids":[43568706,43567780,43568362,43568823,43568193,43569440,43572406],"score":33,"text":"Hello, this is Edgar! We are open sourcing nix-ninja, an incremental build system for Nix that leverages dynamic derivations.<p>For those unfamiliar, Nix is a powerful package manager and build system that ensures reproducible builds via strict dependency isolation. However, one of its limitations has been that it builds packages as monolithic units - if you change one source file, Nix rebuilds the entire package from scratch.<p>nix-ninja solves this by bringing compilation unit level granularity to Nix builds. It targets ninja build files, a format for describing build graphs output by popular build systems like CMake and meson. This means that when you modify a single source file, only the affected compilation units need to be rebuilt, significantly reducing build times.<p>We&#x27;re excited because this gives Nix fine-grained caching with early cutoff optimisation (see the Build Systems à la Carte paper). Combined with remote build farms like Nixbuild.net, this moves Nix into the incremental cloud build systems arena, alongside Google&#x27;s Bazel and Meta&#x27;s Buck2.<p>Dynamic derivations and content-addressed derivations are still experimental features in Nix, so we&#x27;re hoping to accelerate their maturation by providing a compelling use-case and implementation. Our north star is to have Hydra (nixpkgs&#x27; CI runner) support incremental compilation in nixpkgs for slow builds like LLVM.<p>nix-ninja can compile Nix itself today, but we&#x27;re still very early in its development. Given community interest in dynamic derivations and incremental compilation in Nix, we decided to open source it in an pre-alpha state to involve the community in its design.<p>Please take a look. We&#x27;ll be available in the comments to answer any questions: <a href=\"https:&#x2F;&#x2F;github.com&#x2F;pdtpartners&#x2F;nix-ninja\" rel=\"nofollow\">https:&#x2F;&#x2F;github.com&#x2F;pdtpartners&#x2F;nix-ninja</a>","time":1743677231,"title":"Show HN: Nix Ninja – open-source Ninja-compatible build system for Nix","type":"story","url":"https://github.com/pdtpartners/nix-ninja"}