diff --git a/lix/libutil/config.cc b/lix/libutil/config.cc index 7600df038..95a85b9ca 100644 --- a/lix/libutil/config.cc +++ b/lix/libutil/config.cc @@ -344,22 +344,11 @@ template<> std::string BaseSetting::to_string() const template<> ExperimentalFeatures BaseSetting::parse(const std::string & str, const ApplyConfigOptions & options) const { - auto warnDeprecated294 = [](std::once_flag & flag, std::string_view thing) { - std::call_once(flag, [&] { - warn( - "The %s experimental feature is deprecated and will be removed in Lix 2.94. " - "See https://git.lix.systems/lix-project/lix/issues/815 for more details.", - thing - ); - }); - }; - ExperimentalFeatures res{}; for (auto & s : tokenizeString(str)) { if (auto thisXpFeature = parseExperimentalFeature(s); thisXpFeature) { if (*thisXpFeature == Xp::CaDerivations) { - static std::once_flag warned; - warnDeprecated294(warned, s); + throw Error("CA derivations are no longer supported"); } res = res | thisXpFeature.value(); } else diff --git a/tests/functional/build-remote-content-addressed-floating.sh b/tests/functional/build-remote-content-addressed-floating.sh deleted file mode 100644 index e83b42b41..000000000 --- a/tests/functional/build-remote-content-addressed-floating.sh +++ /dev/null @@ -1,9 +0,0 @@ -source common.sh - -file=build-hook-ca-floating.nix - -enableFeatures "ca-derivations" - -CONTENT_ADDRESSED=true - -source build-remote.sh diff --git a/tests/functional/ca/build-cache.sh b/tests/functional/ca/build-cache.sh deleted file mode 100755 index 9b3b61e87..000000000 --- a/tests/functional/ca/build-cache.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env bash - -source common.sh - -# The substituters didn't work prior to this time. -requireDaemonNewerThan "2.18.0pre20230808" - -drv=$(nix-instantiate ./content-addressed.nix -A rootCA --arg seed 1)^out -nix derivation show "$drv" --arg seed 1 - -buildAttr () { - local derivationPath=$1 - local seedValue=$2 - shift; shift - local args=("./content-addressed.nix" "-A" "$derivationPath" --arg seed "$seedValue" "--no-out-link") - args+=("$@") - nix-build "${args[@]}" -} - -copyAttr () { - local derivationPath=$1 - local seedValue=$2 - shift; shift - local args=("-f" "./content-addressed.nix" "$derivationPath" --arg seed "$seedValue") - args+=("$@") - # Note: to copy CA derivations, we need to copy the realisations, which - # currently requires naming the installables, not just the derivation output - # path. - nix copy --to file://$cacheDir "${args[@]}" -} - -testRemoteCacheFor () { - local derivationPath=$1 - clearCache - copyAttr "$derivationPath" 1 - clearStore - # Check nothing gets built. - buildAttr "$derivationPath" 1 --option substituters file://$cacheDir --no-require-sigs |& grepQuietInverse " will be built:" -} - -testRemoteCache () { - testRemoteCacheFor rootCA - testRemoteCacheFor dependentCA - testRemoteCacheFor dependentNonCA - testRemoteCacheFor dependentFixedOutput - testRemoteCacheFor dependentForBuildCA - testRemoteCacheFor dependentForBuildNonCA -} - -clearStore -testRemoteCache diff --git a/tests/functional/ca/build-dry.sh b/tests/functional/ca/build-dry.sh deleted file mode 100644 index 7d4406e2f..000000000 --- a/tests/functional/ca/build-dry.sh +++ /dev/null @@ -1,5 +0,0 @@ -source common.sh - -export NIX_TESTS_CA_BY_DEFAULT=1 - -cd .. && source build-dry.sh diff --git a/tests/functional/ca/build-with-garbage-path.sh b/tests/functional/ca/build-with-garbage-path.sh deleted file mode 100755 index 884cd2802..000000000 --- a/tests/functional/ca/build-with-garbage-path.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env bash - -# Regression test for https://github.com/NixOS/nix/issues/4858 - -source common.sh - -requireDaemonNewerThan "2.4pre20210621" - -# Get the output path of `rootCA`, and put some garbage instead -outPath="$(nix-build ./content-addressed.nix -A rootCA --no-out-link)" -nix-store --delete $(nix-store -q --referrers-closure "$outPath") -touch "$outPath" - -# The build should correctly remove the garbage and put the expected path instead -nix-build ./content-addressed.nix -A rootCA --no-out-link - -# Rebuild it. This shouldn’t overwrite the existing path -oldInode=$(stat -c '%i' "$outPath") -nix-build ./content-addressed.nix -A rootCA --no-out-link --arg seed 2 -newInode=$(stat -c '%i' "$outPath") -[[ "$oldInode" == "$newInode" ]] diff --git a/tests/functional/ca/build.sh b/tests/functional/ca/build.sh deleted file mode 100755 index e1a8a7625..000000000 --- a/tests/functional/ca/build.sh +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/env bash - -source common.sh - -drv=$(nix-instantiate ./content-addressed.nix -A rootCA --arg seed 1)^out -nix derivation show "$drv" --arg seed 1 - -buildAttr () { - local derivationPath=$1 - local seedValue=$2 - shift; shift - local args=("./content-addressed.nix" "-A" "$derivationPath" --arg seed "$seedValue" "--no-out-link") - args+=("$@") - nix-build "${args[@]}" -} - -testDeterministicCA () { - [[ $(buildAttr rootCA 1) = $(buildAttr rootCA 2) ]] -} - -testCutoffFor () { - local out1 out2 - out1=$(buildAttr $1 1) - # The seed only changes the root derivation, and not it's output, so the - # dependent derivations should only need to be built once. - buildAttr rootCA 2 - out2=$(buildAttr $1 2 -j0) - test "$out1" == "$out2" -} - -testCutoff () { - # Don't directly build dependentCA, that way we'll make sure we don't rely on - # dependent derivations always being already built. - #testDerivation dependentCA - testCutoffFor transitivelyDependentCA - testCutoffFor dependentNonCA - testCutoffFor dependentFixedOutput -} - -testGC () { - nix-instantiate ./content-addressed.nix -A rootCA --arg seed 5 - nix-collect-garbage --option keep-derivations true - clearStore - buildAttr rootCA 1 --out-link $TEST_ROOT/rootCA - nix-collect-garbage - buildAttr rootCA 1 -j0 -} - -testNixCommand () { - clearStore - nix build --file ./content-addressed.nix --no-link -} - -# Regression test for https://github.com/NixOS/nix/issues/4775 -testNormalization () { - clearStore - outPath=$(buildAttr rootCA 1) - test "$(stat -c %Y $outPath)" -eq 1 -} - -clearStore -testNormalization -testDeterministicCA -clearStore -testCutoff -testGC -testNixCommand diff --git a/tests/functional/ca/common.sh b/tests/functional/ca/common.sh deleted file mode 100644 index b104b5a78..000000000 --- a/tests/functional/ca/common.sh +++ /dev/null @@ -1,5 +0,0 @@ -source ../common.sh - -enableFeatures "ca-derivations" - -restartDaemon diff --git a/tests/functional/ca/concurrent-builds.sh b/tests/functional/ca/concurrent-builds.sh deleted file mode 100755 index b442619e2..000000000 --- a/tests/functional/ca/concurrent-builds.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env bash - -# Ensure that we can’t build twice the same derivation concurrently. -# Regression test for https://github.com/NixOS/nix/issues/5029 - -source common.sh - -buggyNeedLocalStore "For some reason, this deadlocks with the daemon" - -export NIX_TESTS_CA_BY_DEFAULT=1 - -clearStore - -for i in {0..5}; do - nix build --no-link --file ./racy.nix & -done - -wait diff --git a/tests/functional/ca/config.nix.in b/tests/functional/ca/config.nix.in deleted file mode 120000 index af24ddb30..000000000 --- a/tests/functional/ca/config.nix.in +++ /dev/null @@ -1 +0,0 @@ -../config.nix.in \ No newline at end of file diff --git a/tests/functional/ca/content-addressed.nix b/tests/functional/ca/content-addressed.nix deleted file mode 100644 index 2559c562f..000000000 --- a/tests/functional/ca/content-addressed.nix +++ /dev/null @@ -1,100 +0,0 @@ -with import ./config.nix; - -let mkCADerivation = args: mkDerivation ({ - __contentAddressed = true; - outputHashMode = "recursive"; - outputHashAlgo = "sha256"; -} // args); -in - -{ seed ? 0 }: -# A simple content-addressed derivation. -# The derivation can be arbitrarily modified by passing a different `seed`, -# but the output will always be the same -rec { - rootLegacy = mkDerivation { - name = "simple-input-addressed"; - buildCommand = '' - set -x - echo "Building a legacy derivation" - mkdir -p $out - echo "Hello World" > $out/hello - ''; - }; - rootCA = mkCADerivation { - name = "rootCA"; - outputs = [ "out" "dev" "foo" ]; - buildCommand = '' - echo "building a CA derivation" - echo "The seed is ${toString seed}" - mkdir -p $out - echo ${rootLegacy}/hello > $out/dep - ln -s $out $out/self - # test symlinks at root - ln -s $out $dev - ln -s $out $foo - ''; - }; - dependentCA = mkCADerivation { - name = "dependent"; - buildCommand = '' - echo "building a dependent derivation" - mkdir -p $out - cat ${rootCA}/self/dep - echo ${rootCA}/self/dep > $out/dep - ''; - }; - transitivelyDependentCA = mkCADerivation { - name = "transitively-dependent"; - buildCommand = '' - echo "building transitively-dependent" - cat ${dependentCA}/dep - echo ${dependentCA} > $out - ''; - }; - dependentNonCA = mkDerivation { - name = "dependent-non-ca"; - buildCommand = '' - echo "Didn't cut-off" - echo "building dependent-non-ca" - mkdir -p $out - echo ${rootCA}/non-ca-hello > $out/dep - ''; - }; - dependentForBuildCA = mkCADerivation { - name = "dependent-for-build-ca"; - buildCommand = '' - echo "Depends on rootCA for building only" - mkdir -p $out - echo ${rootCA} - touch $out - ''; - }; - dependentForBuildNonCA = mkDerivation { - name = "dependent-for-build-non-ca"; - buildCommand = '' - echo "Depends on rootCA for building only" - mkdir -p $out - echo ${rootCA} - touch $out - ''; - }; - dependentFixedOutput = mkDerivation { - name = "dependent-fixed-output"; - outputHashMode = "recursive"; - outputHash = "sha512-7aJcmSuEuYP5tGKcmGY8bRr/lrCjJlOxP2mIUjO/vMQeg6gx/65IbzRWES8EKiPDOs9z+wF30lEfcwxM/cT4pw=="; - buildCommand = '' - cat ${dependentCA}/dep - echo foo > $out - ''; - }; - runnable = mkCADerivation rec { - name = "runnable-thing"; - buildCommand = '' - mkdir -p $out/bin - echo ${rootCA} # Just to make it depend on it - echo "#! ${shell}" > $out/bin/${name} - chmod +x $out/bin/${name} - ''; - }; -} diff --git a/tests/functional/ca/derivation-json.sh b/tests/functional/ca/derivation-json.sh deleted file mode 100644 index 318a32ce0..000000000 --- a/tests/functional/ca/derivation-json.sh +++ /dev/null @@ -1,29 +0,0 @@ -source common.sh - -export NIX_TESTS_CA_BY_DEFAULT=1 - -drvPath=$(nix-instantiate ../simple.nix) - -nix derivation show $drvPath | jq .[] > $TEST_HOME/simple.json - -drvPath2=$(nix derivation add < $TEST_HOME/simple.json) - -[[ "$drvPath" = "$drvPath2" ]] - -# Content-addressed derivations can be renamed. -jq '.name = "foo"' < $TEST_HOME/simple.json > $TEST_HOME/foo.json -drvPath3=$(nix derivation add --dry-run < $TEST_HOME/foo.json) -# With --dry-run nothing is actually written -[[ ! -e "$drvPath3" ]] - -# But the JSON is rejected without the experimental feature -expectStderr 1 nix derivation add < $TEST_HOME/foo.json --experimental-features nix-command | grepQuiet "experimental Lix feature 'ca-derivations' is disabled" - -# Without --dry-run it is actually written -drvPath4=$(nix derivation add < $TEST_HOME/foo.json) -[[ "$drvPath4" = "$drvPath3" ]] -[[ -e "$drvPath3" ]] - -# The modified derivation read back as JSON matches -nix derivation show $drvPath3 | jq .[] > $TEST_HOME/foo-read.json -diff $TEST_HOME/foo.json $TEST_HOME/foo-read.json diff --git a/tests/functional/ca/duplicate-realisation-in-closure.sh b/tests/functional/ca/duplicate-realisation-in-closure.sh deleted file mode 100644 index da9cd8fb4..000000000 --- a/tests/functional/ca/duplicate-realisation-in-closure.sh +++ /dev/null @@ -1,26 +0,0 @@ -source ./common.sh - -requireDaemonNewerThan "2.4pre20210625" - -export REMOTE_STORE_DIR="$TEST_ROOT/remote_store" -export REMOTE_STORE="file://$REMOTE_STORE_DIR" - -rm -rf $REMOTE_STORE_DIR -clearStore - -# Build dep1 and push that to the binary cache. -# This entails building (and pushing) current-time. -nix copy --to "$REMOTE_STORE" -f nondeterministic.nix dep1 -clearStore -sleep 2 # To make sure that `$(date)` will be different -# Build dep2. -# As we’ve cleared the cache, we’ll have to rebuild current-time. And because -# the current time isn’t the same as before, this will yield a new (different) -# realisation -nix build -f nondeterministic.nix dep2 --no-link - -# Build something that depends both on dep1 and dep2. -# If everything goes right, we should rebuild dep2 rather than fetch it from -# the cache (because that would mean duplicating `current-time` in the closure), -# and have `dep1 == dep2`. -nix build --substituters "$REMOTE_STORE" -f nondeterministic.nix toplevel --no-require-sigs --no-link diff --git a/tests/functional/ca/eval-store.sh b/tests/functional/ca/eval-store.sh deleted file mode 100755 index 9cc499606..000000000 --- a/tests/functional/ca/eval-store.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash - -# Ensure that garbage collection works properly with ca derivations - -source common.sh - -export NIX_TESTS_CA_BY_DEFAULT=1 - -cd .. -source eval-store.sh diff --git a/tests/functional/ca/flake.nix b/tests/functional/ca/flake.nix deleted file mode 100644 index 332c92a67..000000000 --- a/tests/functional/ca/flake.nix +++ /dev/null @@ -1,3 +0,0 @@ -{ - outputs = { self }: import ./content-addressed.nix {}; -} diff --git a/tests/functional/ca/gc.sh b/tests/functional/ca/gc.sh deleted file mode 100755 index e9b6c5ab5..000000000 --- a/tests/functional/ca/gc.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash - -# Ensure that garbage collection works properly with ca derivations - -source common.sh - -export NIX_TESTS_CA_BY_DEFAULT=1 - -cd .. -source gc.sh diff --git a/tests/functional/ca/import-derivation.sh b/tests/functional/ca/import-derivation.sh deleted file mode 100644 index bc72011f9..000000000 --- a/tests/functional/ca/import-derivation.sh +++ /dev/null @@ -1,5 +0,0 @@ -source common.sh - -export NIX_TESTS_CA_BY_DEFAULT=1 - -cd .. && source import-derivation.sh diff --git a/tests/functional/ca/meson.build b/tests/functional/ca/meson.build deleted file mode 100644 index f3f4a3b2b..000000000 --- a/tests/functional/ca/meson.build +++ /dev/null @@ -1,6 +0,0 @@ -# test_confdata set from tests/functional/meson.build -configure_file( - input : 'config.nix.in', - output : 'config.nix', - configuration : test_confdata, -) diff --git a/tests/functional/ca/new-build-cmd.sh b/tests/functional/ca/new-build-cmd.sh deleted file mode 100644 index 432d4d132..000000000 --- a/tests/functional/ca/new-build-cmd.sh +++ /dev/null @@ -1,5 +0,0 @@ -source common.sh - -export NIX_TESTS_CA_BY_DEFAULT=1 -cd .. -source ./build.sh diff --git a/tests/functional/ca/nix-copy.sh b/tests/functional/ca/nix-copy.sh deleted file mode 100755 index 7a8307a4e..000000000 --- a/tests/functional/ca/nix-copy.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env bash - -source common.sh - -export REMOTE_STORE_DIR="$TEST_ROOT/remote_store" -export REMOTE_STORE="file://$REMOTE_STORE_DIR" - -ensureCorrectlyCopied () { - attrPath="$1" - nix build --store "$REMOTE_STORE" --file ./content-addressed.nix "$attrPath" -} - -testOneCopy () { - clearStore - rm -rf "$REMOTE_STORE_DIR" - - attrPath="$1" - nix copy --to $REMOTE_STORE "$attrPath" --file ./content-addressed.nix - - ensureCorrectlyCopied "$attrPath" - - # Ensure that we can copy back what we put in the store - clearStore - nix copy --from $REMOTE_STORE \ - --file ./content-addressed.nix "$attrPath" \ - --no-check-sigs -} - -for attrPath in rootCA dependentCA transitivelyDependentCA dependentNonCA dependentFixedOutput; do - testOneCopy "$attrPath" -done diff --git a/tests/functional/ca/nix-run.sh b/tests/functional/ca/nix-run.sh deleted file mode 100755 index 5f46518e8..000000000 --- a/tests/functional/ca/nix-run.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash - -source common.sh - -FLAKE_PATH=path:$PWD - -nix run --no-write-lock-file $FLAKE_PATH#runnable diff --git a/tests/functional/ca/nix-shell.sh b/tests/functional/ca/nix-shell.sh deleted file mode 100755 index a9b09069e..000000000 --- a/tests/functional/ca/nix-shell.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash - -source common.sh - -CONTENT_ADDRESSED=true -cd ../nix-shell -source ./basic.sh diff --git a/tests/functional/ca/nondeterministic.nix b/tests/functional/ca/nondeterministic.nix deleted file mode 100644 index 642ec32ae..000000000 --- a/tests/functional/ca/nondeterministic.nix +++ /dev/null @@ -1,34 +0,0 @@ -with import ./config.nix; - -let mkCADerivation = args: mkDerivation ({ - __contentAddressed = true; - outputHashMode = "recursive"; - outputHashAlgo = "sha256"; -} // args); -in - -rec { - currentTime = mkCADerivation { - name = "current-time"; - buildCommand = '' - mkdir $out - echo $(date) > $out/current-time - ''; - }; - dep = seed: mkCADerivation { - name = "dep"; - inherit seed; - buildCommand = '' - echo ${currentTime} > $out - ''; - }; - dep1 = dep 1; - dep2 = dep 2; - toplevel = mkCADerivation { - name = "toplevel"; - buildCommand = '' - test ${dep1} == ${dep2} - touch $out - ''; - }; -} diff --git a/tests/functional/ca/post-hook.sh b/tests/functional/ca/post-hook.sh deleted file mode 100755 index 3a90d2795..000000000 --- a/tests/functional/ca/post-hook.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -source common.sh - -requireDaemonNewerThan "2.4pre20210626" - -export NIX_TESTS_CA_BY_DEFAULT=1 -cd .. -source ./post-hook.sh diff --git a/tests/functional/ca/racy.nix b/tests/functional/ca/racy.nix deleted file mode 100644 index 555a15484..000000000 --- a/tests/functional/ca/racy.nix +++ /dev/null @@ -1,15 +0,0 @@ -# A derivation that would certainly fail if several builders tried to -# build it at once. - - -with import ./config.nix; - -mkDerivation { - name = "simple"; - buildCommand = '' - mkdir $out - echo bar >> $out/foo - sleep 3 - [[ "$(cat $out/foo)" == bar ]] - ''; -} diff --git a/tests/functional/ca/repl.sh b/tests/functional/ca/repl.sh deleted file mode 100644 index 3808c7cb2..000000000 --- a/tests/functional/ca/repl.sh +++ /dev/null @@ -1,5 +0,0 @@ -source common.sh - -export NIX_TESTS_CA_BY_DEFAULT=1 - -cd .. && source repl.sh diff --git a/tests/functional/ca/selfref-gc.sh b/tests/functional/ca/selfref-gc.sh deleted file mode 100755 index 248778894..000000000 --- a/tests/functional/ca/selfref-gc.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -source common.sh - -requireDaemonNewerThan "2.4pre20210626" - -enableFeatures "ca-derivations nix-command flakes" - -export NIX_TESTS_CA_BY_DEFAULT=1 -cd .. -source ./selfref-gc.sh diff --git a/tests/functional/ca/signatures.sh b/tests/functional/ca/signatures.sh deleted file mode 100644 index eb18a4130..000000000 --- a/tests/functional/ca/signatures.sh +++ /dev/null @@ -1,36 +0,0 @@ -source common.sh - -clearStore -clearCache - -nix-store --generate-binary-cache-key cache1.example.org $TEST_ROOT/sk1 $TEST_ROOT/pk1 -pk1=$(cat $TEST_ROOT/pk1) - -export REMOTE_STORE_DIR="$TEST_ROOT/remote_store" -export REMOTE_STORE="file://$REMOTE_STORE_DIR" - -ensureCorrectlyCopied () { - attrPath="$1" - nix build --store "$REMOTE_STORE" --file ./content-addressed.nix "$attrPath" -} - -testOneCopy () { - clearStore - rm -rf "$REMOTE_STORE_DIR" - - attrPath="$1" - nix copy -vvvv --to $REMOTE_STORE "$attrPath" --file ./content-addressed.nix \ - --secret-key-files "$TEST_ROOT/sk1" --show-trace - - ensureCorrectlyCopied "$attrPath" - - # Ensure that we can copy back what we put in the store - clearStore - nix copy --from $REMOTE_STORE \ - --file ./content-addressed.nix "$attrPath" \ - --trusted-public-keys $pk1 -} - -for attrPath in rootCA dependentCA transitivelyDependentCA dependentNonCA dependentFixedOutput; do - testOneCopy "$attrPath" -done diff --git a/tests/functional/ca/substitute.sh b/tests/functional/ca/substitute.sh deleted file mode 100755 index ea981adc4..000000000 --- a/tests/functional/ca/substitute.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/env bash - -# Ensure that binary substitution works properly with ca derivations - -source common.sh - -needLocalStore "“--no-require-sigs” can’t be used with the daemon" - -rm -rf $TEST_ROOT/binary_cache - -export REMOTE_STORE_DIR=$TEST_ROOT/binary_cache -export REMOTE_STORE=file://$REMOTE_STORE_DIR - -buildDrvs () { - nix build --file ./content-addressed.nix -L --no-link "$@" -} - -# Populate the remote cache -clearStore -nix copy --to $REMOTE_STORE --file ./content-addressed.nix - -# Restart the build on an empty store, ensuring that we don't build -clearStore -buildDrvs --substitute --substituters $REMOTE_STORE --no-require-sigs -j0 transitivelyDependentCA -# Check that the thing we’ve just substituted has its realisation stored -nix realisation info --file ./content-addressed.nix transitivelyDependentCA -# Check that its dependencies have it too -nix realisation info --file ./content-addressed.nix dependentCA -# nix realisation info --file ./content-addressed.nix rootCA --outputs out - -if isDaemonNewer "2.13"; then - pushToStore="../push-to-store.sh" -else - pushToStore="../push-to-store-old.sh" -fi - -# Same thing, but -# 1. With non-ca derivations -# 2. Erasing the realisations on the remote store -# -# Even in that case, realising the derivations should still produce the right -# realisations on the local store -# -# Regression test for #4725 -clearStore -nix build --file ../simple.nix -L --no-link --post-build-hook "$pushToStore" -clearStore -rm -r "$REMOTE_STORE_DIR/realisations" -nix build --file ../simple.nix -L --no-link --substitute --substituters "$REMOTE_STORE" --no-require-sigs -j0 -# There's no easy way to check whether a realisation is present on the local -# store − short of manually querying the db, but the build environment doesn't -# have the sqlite binary − so we instead push things again, and check that the -# realisations have correctly been pushed to the remote store -nix copy --to "$REMOTE_STORE" --file ../simple.nix -if [[ -z "$(ls "$REMOTE_STORE_DIR/realisations")" ]]; then - echo "Realisations not rebuilt" - exit 1 -fi - -# Test the local realisation disk cache -buildDrvs --post-build-hook "$pushToStore" -clearStore -# Add the realisations of rootCA to the cachecache -clearCacheCache -export _NIX_FORCE_HTTP=1 -buildDrvs --substitute --substituters $REMOTE_STORE --no-require-sigs -j0 -# Try rebuilding, but remove the realisations from the remote cache to force -# using the cachecache -clearStore -rm $REMOTE_STORE_DIR/realisations/* -buildDrvs --substitute --substituters $REMOTE_STORE --no-require-sigs -j0 diff --git a/tests/functional/ca/why-depends.sh b/tests/functional/ca/why-depends.sh deleted file mode 100644 index 0c079f63b..000000000 --- a/tests/functional/ca/why-depends.sh +++ /dev/null @@ -1,5 +0,0 @@ -source common.sh - -export NIX_TESTS_CA_BY_DEFAULT=1 - -cd .. && source why-depends.sh diff --git a/tests/functional/meson.build b/tests/functional/meson.build index d989713d0..8dd142ccf 100644 --- a/tests/functional/meson.build +++ b/tests/functional/meson.build @@ -23,9 +23,7 @@ config_nix_in = configure_file( configuration : test_confdata, ) -# Just configures `ca/config.nix.in`. Done as a subdir() for the same reason as above. -subdir('ca') -# Just configures `nix-shell/config.nix.in`. Same as above. +# Just configures `nix-shell/config.nix.in`. Done as a subdir() for the same reason as above. subdir('nix-shell') subdir('plugins') @@ -34,24 +32,6 @@ subdir('test-libstoreconsumer') functional_tests_scripts = [ 'init.sh', 'test-infra.sh', - 'ca/build.sh', - 'ca/build-cache.sh', - 'ca/concurrent-builds.sh', - 'ca/derivation-json.sh', - 'ca/duplicate-realisation-in-closure.sh', - 'ca/eval-store.sh', - 'ca/gc.sh', - 'ca/import-derivation.sh', - 'ca/new-build-cmd.sh', - 'ca/nix-copy.sh', - 'ca/nix-run.sh', - 'ca/nix-shell.sh', - 'ca/post-hook.sh', - 'ca/repl.sh', - 'ca/selfref-gc.sh', - 'ca/signatures.sh', - 'ca/substitute.sh', - 'ca/why-depends.sh', 'flakes/flakes.sh', 'flakes/develop.sh', 'flakes/develop-r8854.sh', @@ -121,7 +101,6 @@ functional_tests_scripts = [ 'dependencies.sh', 'check-reqs.sh', 'build-remote-content-addressed-fixed.sh', - 'build-remote-content-addressed-floating.sh', 'build-remote-trustless-should-pass-0.sh', 'build-remote-trustless-should-pass-1.sh', 'build-remote-trustless-should-pass-2.sh', diff --git a/tests/functional/nix-profile.sh b/tests/functional/nix-profile.sh index 13a73ead9..150650a55 100644 --- a/tests/functional/nix-profile.sh +++ b/tests/functional/nix-profile.sh @@ -3,7 +3,6 @@ source common.sh clearStore clearProfiles -enableFeatures "ca-derivations" restartDaemon # Make a flake. @@ -105,24 +104,10 @@ nix profile remove simple-1 2>&1 | grep 'removed 1 packages' nix profile wipe-history [[ $(nix profile history | grep Version | wc -l) -eq 1 ]] -# Test upgrade to CA package. -printf true > $flake1Dir/ca.nix -printf 3.0 > $flake1Dir/version -nix profile upgrade flake1 -nix profile history | grep "packages.$system.default: 1.0, 1.0-man -> 3.0, 3.0-man" - -# Test new install of CA package. -nix profile remove flake1 2>&1 | grep 'removed 1 packages' -printf 4.0 > $flake1Dir/version -printf Utrecht > $flake1Dir/who -nix profile install $flake1Dir -[[ $($TEST_HOME/.nix-profile/bin/hello) = "Hello Utrecht" ]] -[[ $(nix path-info --json $(realpath $TEST_HOME/.nix-profile/bin/hello) | jq -r .[].ca) =~ fixed:r:sha256: ]] - # Override the outputs. nix profile remove simple flake1 nix profile install "$flake1Dir^*" -[[ $($TEST_HOME/.nix-profile/bin/hello) = "Hello Utrecht" ]] +[[ $($TEST_HOME/.nix-profile/bin/hello) = "Hello NixOS" ]] [ -e $TEST_HOME/.nix-profile/share/man ] [ -e $TEST_HOME/.nix-profile/include ] diff --git a/tests/functional/repl.sh b/tests/functional/repl.sh index e205fc812..54acc4986 100644 --- a/tests/functional/repl.sh +++ b/tests/functional/repl.sh @@ -125,16 +125,6 @@ drvPath ' '".*-simple.drv"' \ --file $testDir/simple.nix -testReplResponse ' -drvPath -' '".*-simple.drv"' \ ---file $testDir/simple.nix --experimental-features 'ca-derivations' - -testReplResponse ' -drvPath -' '".*-simple.drv"' \ ---file $testDir/simple.nix --extra-experimental-features 'ca-derivations' - mkdir -p flake && cat < flake/flake.nix { outputs = { self }: { diff --git a/tests/unit/libexpr/derived-path.cc b/tests/unit/libexpr/derived-path.cc index 7257ba410..dfcce516e 100644 --- a/tests/unit/libexpr/derived-path.cc +++ b/tests/unit/libexpr/derived-path.cc @@ -46,7 +46,7 @@ RC_GTEST_FIXTURE_PROP( * to worry about race conditions if the tests run concurrently. */ ExperimentalFeatureSettings mockXpSettings; - mockXpSettings.set("experimental-features", "ca-derivations"); + mockXpSettings.experimentalFeatures.override(ExperimentalFeatures{} | Xp::CaDerivations); auto * v = evaluator.mem.allocValue(); state.mkOutputString(*v, b, std::nullopt, mockXpSettings); diff --git a/tests/unit/libstore/derivation.cc b/tests/unit/libstore/derivation.cc index fca6b06c8..69fe7c484 100644 --- a/tests/unit/libstore/derivation.cc +++ b/tests/unit/libstore/derivation.cc @@ -1,6 +1,7 @@ #include #include "lix/libstore/derivations.hh" +#include "lix/libutil/experimental-features.hh" #include "lix/libutil/json.hh" #include "lix/libutil/strings.hh" @@ -29,7 +30,7 @@ class CaDerivationTest : public DerivationTest { void SetUp() override { - mockXpSettings.set("experimental-features", "ca-derivations"); + mockXpSettings.experimentalFeatures.override(ExperimentalFeatures{} | Xp::CaDerivations); } }; diff --git a/tests/unit/libstore/downstream-placeholder.cc b/tests/unit/libstore/downstream-placeholder.cc index d67932f35..069e259f5 100644 --- a/tests/unit/libstore/downstream-placeholder.cc +++ b/tests/unit/libstore/downstream-placeholder.cc @@ -10,7 +10,7 @@ TEST(DownstreamPlaceholder, unknownCaOutput) { * to worry about race conditions if the tests run concurrently. */ ExperimentalFeatureSettings mockXpSettings; - mockXpSettings.set("experimental-features", "ca-derivations"); + mockXpSettings.experimentalFeatures.override(ExperimentalFeatures{} | Xp::CaDerivations); ASSERT_EQ( DownstreamPlaceholder::unknownCaOutput(