version: ~> 1.0
import: nix-community/nix-travis-ci:nix.yml@main

dist: xenial
os: linux

env:
  global:
    - CACHIX_CACHE="xeals"
    - NUR_REPO="xeals"

jobs:
  include:
    - env: NIX_PATH=nixpkgs=channel:nixpkgs-unstable
    - env: NIX_PATH=nixpkgs=channel:nixos-unstable
    # - env: NIX_PATH=nixpkgs=channel:nixos-20.03

script:
 - nix-build ci.nix -kA buildOutputs
 - nix eval -f default.nix 'lib'
 - nix eval -f default.nix 'modules'
 - nix eval -f default.nix 'overlays'

after_success:
  - if [ -n "${CACHIX_CACHE}" ]; then nix-build ci.nix -kA cacheOutputs | cachix push "${CACHIX_CACHE}"; fi
  - if [[ NUR_REPO != "xeals" && "cron" != "${TRAVIS_EVENT_TYPE}" && "false" = "${TRAVIS_PULL_REQUEST}" && "master" = "${TRAVIS_BRANCH}" ]]; then
      curl -XPOST "https://nur-update.herokuapp.com/update?repo=${NUR_REPO}"; fi