Nix on Travis: Difference between revisions

imported>Asymmetric
m Caching dependencies: binary-caches -> substituters
imported>Erikarvstedt
mNo edit summary
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
Travis-CI provides a <code>language: nix</code> setting (to put in a ''.travis.yml'' file) to run continuous integration scripts on a machine with Nix installed.
Travis-CI provides a <code>language: nix</code> setting (to put in a ''.travis.yml'' file) to run continuous integration scripts on a machine with Nix installed.


See [https://docs.travis-ci.com/user/languages/nix Travis-CI documentation for Nix].
See [https://docs.travis-ci.com/user/languages/nix Travis-CI documentation for Nix], [https://github.com/travis-ci/travis-build/blob/master/lib/travis/build/script/nix.rb Travis source code for Nix].


== Caching dependencies ==
== Caching dependencies ==
Line 33: Line 33:


NB: in this setting, the cache only grows. It might be manually deleted when it becomes too bloated but smarter eviction strategies can be implemented too!
NB: in this setting, the cache only grows. It might be manually deleted when it becomes too bloated but smarter eviction strategies can be implemented too!
== Enable sandboxed builds ==
At the moment travis does not have a sandbox enabled by default.
This can lead to non-trivial to reproduce errors,
when files from the travis image interfere with the build.
Enabling however is straight-forward by using the following little snippet:
<syntaxHighlight lang=nix>
before_script:
  - sudo mkdir -p /etc/nix && echo 'sandbox = true' | sudo tee /etc/nix/nix.conf
</syntaxHighlight>