This is a redesign from9b1f3cbc13where this was introduced. I deleted the AbstractConfig::toKeyValue since it was conspicuously and obviously broken for two years since450e5ec618. I asked myself if anyone was using it, given that it only emitted settings that were aliases (broken!), and found that nobody used it. The motivation for this change is the same for only emitting overridden settings to the protocol: the nix inside there may not be able to parse our defaults, as is the case of CppNix since the consensual accept-flake-config was added to Lix. Fixes: https://git.lix.systems/lix-project/lix/issues/739 Change-Id: Ib9874a52137f1f22220c25bcfa2425a4802509c7
59 lines
1.9 KiB
Bash
59 lines
1.9 KiB
Bash
source common.sh
|
|
|
|
clearStore
|
|
|
|
rm -f $TEST_ROOT/result
|
|
|
|
export REMOTE_STORE=file:$TEST_ROOT/remote_store
|
|
echo 'require-sigs = false' >> $NIX_CONF_DIR/nix.conf
|
|
|
|
restartDaemon
|
|
|
|
if isDaemonNewer "2.13"; then
|
|
pushToStore="$PWD/push-to-store.sh"
|
|
else
|
|
pushToStore="$PWD/push-to-store-old.sh"
|
|
fi
|
|
|
|
# Build the dependencies and push them to the remote store.
|
|
nix-build -o $TEST_ROOT/result dependencies.nix --post-build-hook "$pushToStore"
|
|
# See if all outputs are passed to the post-build hook by only specifying one
|
|
# We're not able to test CA tests this way
|
|
export BUILD_HOOK_ONLY_OUT_PATHS=$([ ! $NIX_TESTS_CA_BY_DEFAULT ])
|
|
nix-build -o $TEST_ROOT/result-mult multiple-outputs.nix -A a.first --post-build-hook "$pushToStore"
|
|
|
|
clearStore
|
|
|
|
# Ensure that the remote store contains both the runtime and build-time
|
|
# closure of what we've just built.
|
|
nix copy --from "$REMOTE_STORE" --no-require-sigs -f dependencies.nix
|
|
nix copy --from "$REMOTE_STORE" --no-require-sigs -f dependencies.nix input1_drv
|
|
nix copy --from "$REMOTE_STORE" --no-require-sigs -f multiple-outputs.nix a^second
|
|
|
|
clearStore
|
|
|
|
# Should fail if the build hook fails
|
|
cat > "$TEST_ROOT/fail.sh" <<-EOF
|
|
#!${shell}
|
|
false
|
|
EOF
|
|
chmod +x "$TEST_ROOT/fail.sh"
|
|
expect 1 nix-build -o "$TEST_ROOT/result" dependencies.nix --post-build-hook "$TEST_ROOT/fail.sh"
|
|
clearStore
|
|
|
|
# Ensure that settings are passed into the post-build-hook, but only overridden
|
|
# ones.
|
|
rm -f "${TEST_ROOT}/nix-config"
|
|
cat > "${TEST_ROOT}/settings.sh" <<-EOF
|
|
#!${shell}
|
|
echo "\$NIX_CONFIG" > "${TEST_ROOT}/nix-config"
|
|
EOF
|
|
chmod +x "${TEST_ROOT}/settings.sh"
|
|
nix-build -o "${TEST_ROOT}/result" dependencies.nix --timeout 1337 --post-build-hook "${TEST_ROOT}/settings.sh"
|
|
# Ensure pure-eval cannot become not a setting with the test passing.
|
|
nix config show pure-eval
|
|
# Defaulted setting does not appear.
|
|
expect 1 grepQuiet pure-eval "${TEST_ROOT}/nix-config"
|
|
# Overridden setting appears.
|
|
grepQuiet "timeout = 1337" "${TEST_ROOT}/nix-config"
|