2014-09-21 15:09:35 +04:00
|
|
|
#! /usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
|
2014-10-14 16:31:43 +04:00
|
|
|
export NIX_CURL_FLAGS=-sS
|
|
|
|
|
2014-10-15 13:03:30 +04:00
|
|
|
if [[ $1 == nix ]]; then
|
2014-10-15 20:50:28 +04:00
|
|
|
echo "=== Installing Nix..."
|
2014-10-15 13:03:30 +04:00
|
|
|
# Install Nix
|
2014-10-15 20:45:13 +04:00
|
|
|
bash <(curl -sS https://nixos.org/nix/install)
|
2014-10-15 13:03:30 +04:00
|
|
|
source $HOME/.nix-profile/etc/profile.d/nix.sh
|
2014-09-21 15:09:35 +04:00
|
|
|
|
2014-10-15 13:03:30 +04:00
|
|
|
# Make sure we can use hydra's binary cache
|
|
|
|
sudo mkdir /etc/nix
|
|
|
|
sudo tee /etc/nix/nix.conf <<EOF >/dev/null
|
2014-09-23 16:31:01 +04:00
|
|
|
binary-caches = http://cache.nixos.org http://hydra.nixos.org
|
|
|
|
trusted-binary-caches = http://hydra.nixos.org
|
|
|
|
build-max-jobs = 4
|
|
|
|
EOF
|
2014-09-21 15:09:35 +04:00
|
|
|
|
2014-10-15 13:03:30 +04:00
|
|
|
# Verify evaluation
|
2014-10-15 20:50:28 +04:00
|
|
|
echo "=== Verifying that nixpkgs evaluates..."
|
|
|
|
nix-env -f. -qa --json >/dev/null
|
2014-10-15 13:23:34 +04:00
|
|
|
elif [[ $1 == nox ]]; then
|
2014-10-15 20:50:28 +04:00
|
|
|
echo "=== Installing nox..."
|
2014-10-15 13:03:30 +04:00
|
|
|
git clone -q https://github.com/madjar/nox
|
|
|
|
pip --quiet install -e nox
|
|
|
|
elif [[ $1 == build ]]; then
|
2014-10-15 13:52:23 +04:00
|
|
|
source $HOME/.nix-profile/etc/profile.d/nix.sh
|
|
|
|
|
2014-10-15 13:03:30 +04:00
|
|
|
if [[ $TRAVIS_PULL_REQUEST == false ]]; then
|
|
|
|
echo "===> Not a pull request, checking evaluation"
|
|
|
|
nix-build pkgs/top-level/release.nix -A tarball
|
|
|
|
else
|
2014-10-15 20:50:28 +04:00
|
|
|
echo "=== Checking PR"
|
2014-10-15 13:03:30 +04:00
|
|
|
# The current HEAD is the PR merged into origin/master, so we compare
|
|
|
|
# against origin/master
|
2014-10-15 20:45:13 +04:00
|
|
|
nox-review wip --against origin/master
|
2014-10-15 13:03:30 +04:00
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "$0: Unknown option $1" >&2
|
|
|
|
false
|
2014-09-21 15:09:35 +04:00
|
|
|
fi
|