Skip to content

A tool that generates a Nix derivation from a Ninja build file.

License

Notifications You must be signed in to change notification settings

awakesecurity/ninja2nix

Repository files navigation

ninja2nix

Hackage Stackage License

This is a work-in-progress project to make a tool that, given a Ninja build file and a Nix-specified build environment and src, will produce a Nix derivation that runs the Ninja build incrementally, by "exploding" the build graph into the Nix derivation dependency graph. In other words, each node in the Ninja build graph will become a Nix derivation, and the output of this tool is a derivation that combines the outputs of all these Nix derivations corresponding to Ninja build graph nodes.

Ideally, this will allow automatic generation of Nix derivations that allow reproducible, deterministic, incremental builds of:

Limitations

depfile

If you use the Ninja depfile feature in such a way that a build declaration produces a Makefile containing its own dependencies, incrementalism will definitely be lost at best (at worst, the build may be incorrect). Note that the example given for depfile in the Ninja manual seems to have this problem:

rule cc
  depfile = $out.d
  command = gcc -MMD -MF $out.d [other gcc flags here]

This is almost certainly an issue for CMake builds, which use depfile in this way. I am not sure if this also affects kninja, however. I plan on patching upstream to avoid this issue if necessary.

About

A tool that generates a Nix derivation from a Ninja build file.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published