Move flake-searching.sh and make it less dependent on git

This commit is contained in:
Eelco Dolstra 2022-07-13 20:55:08 +02:00
parent 6ba45f81a8
commit 752158a8ef
2 changed files with 12 additions and 14 deletions

View file

@ -1,15 +1,11 @@
source common.sh
if [[ -z $(type -p git) ]]; then
echo "Git not installed; skipping flake search tests"
exit 99
fi
clearStore
cp ./simple.nix ./simple.builder.sh ./config.nix $TEST_HOME
writeSimpleFlake $TEST_HOME
cd $TEST_HOME
mkdir -p foo/subdir
echo '{ outputs = _: {}; }' > foo/flake.nix
cat <<EOF > flake.nix
{
@ -43,10 +39,12 @@ nix build --override-input foo . || fail "flake should search up directories whe
sed "s,$PWD/foo,$PWD/foo/subdir,g" -i flake.nix
! nix build || fail "flake should not search upwards when part of inputs"
pushd subdir
git init
for i in "${success[@]}" "${failure[@]}"; do
! nix build $i || fail "flake should not search past a git repository"
done
rm -rf .git
popd
if [[ -n $(type -p git) ]]; then
pushd subdir
git init
for i in "${success[@]}" "${failure[@]}"; do
! nix build $i || fail "flake should not search past a git repository"
done
rm -rf .git
popd
fi

View file

@ -49,7 +49,7 @@ nix_tests = \
secure-drv-outputs.sh \
restricted.sh \
fetchGitSubmodules.sh \
flake-searching.sh \
flakes/search-root.sh \
ca/duplicate-realisation-in-closure.sh \
readfile-context.sh \
nix-channel.sh \