Building a Nix Project

What This Guide Covers

This guide covers build environment and configuration topics specific to Nix projects. Please make sure to read our Getting Started and general build configuration guides first.

Community-Supported Warning

Travis CI support for Nix is contributed by the community and may be removed or altered at any time. If you run into any problems, please report them in the Travis CI issue tracker and cc @domenkozar @garbas and @matthewbauer .


To install the Nix store and set up a basic single-user profile, set the language key in .travis.yml to nix.

language: nix

The default channel for nixpkgs will be nixpkgs-unstable.

Provided Tools

The following command line tools are available in the Nix environment:

  • nix-env
  • nix-build
  • nix-shell
  • nix-store
  • nix-channel

Default Nix Version

Currently, only version “1.11.2” of Nix is provided. In the future, it may be possible to configure different versions with .travis.yml.

Default Target

The default build script is nix-build which builds everything in the default.nix file of the repository root. This can be overridden by setting the script key in the .travis.yml file. For example,

language: nix
script: nix-build -A tarball release.nix

The above configuration will attempt to build the attribute “tarball” from the Nix expression in release.nix.

Nix manual

More information on writing Nix expressions and how each of the above tools works is available in the Nix manual.