#!/usr/bin/env nix-shell #!nix-shell -i bash #!nix-shell -I nixpkgs=./nix #!nix-shell -p nix #!nix-shell -p nixpkgs-fmt set -euo pipefail export NIX_PATH="nixpkgs=./nix" echo "Building" nixargs=( "--no-link" "--max-jobs" "10" ) targets=( ) if [[ ! $OSTYPE =~ darwin ]]; then echo "Not testing on darwin" echo "Enabling sandbox, running all tests" nixargs+=("--sandbox") else echo "Testing on darwin" echo "Not enabling sandbox, not running integration" targets+=("-A" "niv") fi # Build and create a root nix-build ${nixargs[@]} ${targets[@]} echo "Formatting" if ! nixpkgs-fmt --check . ; then echo echo 'run `nixpkgs-fmt .` to fix this issue' exit 1 fi echo "Building examples" for example in examples/*; do echo " - $(basename $example)" pushd $example nix-build ${nixargs[@]} popd done echo "all good"