CLI#

The main Nixpacks commands are build and plan.

Build#

Create an image from an app source directory. The resulting image can then be run using Docker.

For example

nixpacks build ./path/to/app --name my-app

View all build options with

nixpacks build --help

Options#

--install-cmd <cmd>, -iSpecify the install command
--build-cmd <cmd>, -bSpecify the build command
--start-cmd <cmd>, -sSpecify the start command
--name <name>Name for the built image
--env <envs...>Provide environment variables to your build.
--pkgs <pkgs...>, -pProvide additional Nix packages to install in the environment
--apt <pkgs...>Provide additional apt packages to install in the environment
--libs <libs...>Provide additional Nix libraries to install in the environment
--tag <tag...>, -tAdditional tags to add to the output image
--label <labels...>, -lAdditional labels to add to the output image
--cache-key <key>Unique identifier to use for the build cache
--no-cacheDisable caching for the build
--docker-hostSpecify host for Docker client
--docker-tls-verifySpecify if Docker client should verify the TLS (Transport Layer Security) certificates of the Docker daemon when communicating over a secure connection
--cache-fromImage to consider as cache sources
--inline-cacheEnable writing cache metadata into the output image
--out <dir>, -oSave output directory instead of building it with Docker
--platform <platforms...>Choosing the target platform for the target environment
--config <file>Location of the Nixpacks configuration file relative to the root of the app

Environment Variables#

Environment variables can be provided in the format FOO or FOO=bar. If no equal sign is present then the value is pulled from the current environment.

Labels#

You can provide values to labels, just like Docker. For example, --label org.opencontainers.image.source=https://github.com/owner/repo.

Plan#

The plan command will show the full set of options (nix packages, build cmd, start cmd, etc) that will be used to when building the app. This plan can be saved and used to build the app with the same configuration at a future date.

For example,

nixpacks plan examples/node

By default, the plan is output in JSON format. You can output in TOML format with the --format toml option.

View all plan options with

nixpacks plan --help

Help#

For a full list of CLI commands run

nixpacks --help