2019-02-01 17:51:40 +03:00
|
|
|
#!/usr/bin/env nix-shell
|
|
|
|
#!nix-shell -i bash
|
|
|
|
#!nix-shell -I nixpkgs=./nix
|
|
|
|
#!nix-shell -p nix
|
2019-12-31 14:27:51 +03:00
|
|
|
#!nix-shell -p nixpkgs-fmt
|
2019-02-01 17:51:40 +03:00
|
|
|
|
2019-02-03 16:07:42 +03:00
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
export NIX_PATH="nixpkgs=./nix"
|
|
|
|
|
2019-02-01 17:51:40 +03:00
|
|
|
echo "Building"
|
|
|
|
|
2019-12-08 17:13:53 +03:00
|
|
|
nixargs=(
|
|
|
|
"--no-link"
|
|
|
|
"--max-jobs" "10"
|
|
|
|
)
|
|
|
|
|
2020-01-11 13:45:24 +03:00
|
|
|
targets=(
|
|
|
|
|
|
|
|
)
|
|
|
|
|
2019-12-08 17:13:53 +03:00
|
|
|
|
|
|
|
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"
|
2020-01-20 19:55:55 +03:00
|
|
|
targets+=("-A" "niv")
|
2019-12-08 17:13:53 +03:00
|
|
|
fi
|
|
|
|
|
2019-02-05 16:19:17 +03:00
|
|
|
# Build and create a root
|
2020-01-11 13:45:24 +03:00
|
|
|
nix-build ${nixargs[@]} ${targets[@]}
|
2019-02-03 16:07:42 +03:00
|
|
|
|
2019-12-31 14:27:51 +03:00
|
|
|
echo "Formatting"
|
|
|
|
if ! nixpkgs-fmt --check . ; then
|
|
|
|
echo
|
|
|
|
echo 'run `nixpkgs-fmt .` to fix this issue'
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2020-01-11 13:45:24 +03:00
|
|
|
echo "Building examples"
|
|
|
|
for example in examples/*; do
|
|
|
|
echo " - $(basename $example)"
|
|
|
|
pushd $example
|
|
|
|
nix-build ${nixargs[@]}
|
|
|
|
popd
|
|
|
|
done
|
|
|
|
|
2019-02-01 17:51:40 +03:00
|
|
|
echo "all good"
|