diff --git a/tests/ca/substitute.sh b/tests/ca/substitute.sh new file mode 100644 index 00000000000..398d9b82552 --- /dev/null +++ b/tests/ca/substitute.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +# Ensure that binary substitution works properly with ca derivations + +source common.sh + +export REMOTE_STORE=file://$TEST_ROOT/binary_cache + +buildDrvs () { + nix --experimental-features 'nix-command ca-derivations ca-references' build --file ./content-addressed.nix -L --no-link "$@" +} + +# Populate the remote cache +buildDrvs --post-build-hook ../push-to-store.sh + +# Restart the build on an empty store, ensuring that we don't build +clearStore +buildDrvs --substitute --substituters $REMOTE_STORE --no-require-sigs|& \ + (! grep -q Building) + diff --git a/tests/local.mk b/tests/local.mk index a3e2ab3ca1d..ce90fa04352 100644 --- a/tests/local.mk +++ b/tests/local.mk @@ -38,7 +38,8 @@ nix_tests = \ flakes.sh \ build.sh \ ca/build.sh \ - ca/nix-copy.sh + ca/nix-copy.sh \ + ca/substitute.sh # parallel.sh # build-remote-content-addressed-fixed.sh \