Building a Nix Project
What This Guide Covers #
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, @matthewbauer, and @grahamc.
To install the Nix store and set up a basic single-user profile, set the
language key in
The default channel for
nixpkgs will be
Provided Tools #
The following command line tools are available in the Nix environment:
Default Nix Version #
This installs Nix 2.0.4 using https://nixos.org/releases/nix/nix-2.0.4/install. You may specify a different version of Nix installer with the
nix: key in your
language: nix nix: 2.0.4
Note: This option supports all Nix releases, starting with version 1.11.16.
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.