Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Builds

Building is the part of a deploy that turns a node's NixOS configuration into a system closure. You can build without deploying, and you can choose where the build runs.

Building without deploying

navi build runs the evaluate-and-build stages and stops. Nothing is copied or activated. It is the right check for continuous integration, where you want to know every node still evaluates and builds without touching any of them:

navi build -v
navi build --on 'web-*' -v

The build goal of apply does the same thing for a selection you are about to deploy:

navi apply build --on web-01

Where the build happens

By default Navi builds on the machine that runs the command and copies the result to the target. You can build on the target instead, which helps when the target has resources the local machine lacks, or when you want to avoid copying a large closure over a slow link:

navi build --on web-01 --build-on-target
navi apply --on web-01 --build-on-target -v

Set this per node with deployment.buildOnTarget when a host should always build its own closure:

web-01 = { ... }: {
  deployment.buildOnTarget = true;
};

The command-line flag overrides the node setting for a single run; --no-build-on-target forces a local build even when the node opts in.

Passing options to Nix

--nix-option forwards an arbitrary option to the underlying Nix commands. It only takes effect when building locally. Use it, for example, to point a build at a specific binary cache:

navi apply-local --sudo -v --nix-option substituters https://cache.example.org