naersk/script/test
2020-08-10 11:24:36 +02:00

39 lines
816 B
Text
Executable file

#!/usr/bin/env nix-shell
#!nix-shell -i bash
#!nix-shell -I nixpkgs=./nix
#!nix-shell -p nix
set -euo pipefail
export NIX_PATH="nixpkgs=./nix"
echo "Building"
extraArgs=( )
while [[ $# -gt 0 ]]; do
case "$1" in
"--fast")
echo "running only fast tests"
extraArgs+=( --arg fast true )
shift
;;
"--nixpkgs")
echo "using $2 as niv entry for nixpkgs"
extraArgs+=( --argstr nixpkgs "$2" )
shift; shift;
;;
esac
done
if [[ ! $OSTYPE =~ darwin ]]; then
echo "NOT testing on darwin, enabling sandbox"
extraArgs+=("--sandbox")
else
echo "Testing on darwin, NOT enabling sandbox"
fi
# Build and create a root
nix-build ./test.nix --no-link --max-jobs 4 "${extraArgs[@]}"
echo "all good"