From a55112898e23df10a7a0d2a0cd359996100e3512 Mon Sep 17 00:00:00 2001 From: Alois Wohlschlager Date: Sat, 29 Jun 2024 20:23:17 +0200 Subject: libexpr/flake: allow automatic rejection of configuration options from flakes The `allow-flake-configuration` option allows the user to control whether to accept configuration options supplied by flakes. Unfortunately, setting this to false really meant "ask each time" (with an option to remember the choice for each specific option encountered). Let no mean no, and introduce (and default to) a separate value for the "ask each time" behaviour. Co-Authored-By: Jade Lovelace Change-Id: I7ccd67a95bfc92cffc1ebdc972d243f5191cc1b4 --- tests/functional/experimental-features.sh | 4 ++-- tests/functional/flakes/config.sh | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/functional/experimental-features.sh b/tests/functional/experimental-features.sh index 9ee4a53d4..658ae3cc4 100644 --- a/tests/functional/experimental-features.sh +++ b/tests/functional/experimental-features.sh @@ -32,7 +32,7 @@ NIX_CONFIG=' experimental-features = nix-command accept-flake-config = true ' nix config show accept-flake-config 1>$TEST_ROOT/stdout 2>$TEST_ROOT/stderr -grepQuiet "false" $TEST_ROOT/stdout +grepQuiet "ask" $TEST_ROOT/stdout grepQuiet "Ignoring setting 'accept-flake-config' because experimental feature 'flakes' is not enabled" $TEST_ROOT/stderr # 'flakes' experimental-feature is disabled after, ignore and warn @@ -40,7 +40,7 @@ NIX_CONFIG=' accept-flake-config = true experimental-features = nix-command ' nix config show accept-flake-config 1>$TEST_ROOT/stdout 2>$TEST_ROOT/stderr -grepQuiet "false" $TEST_ROOT/stdout +grepQuiet "ask" $TEST_ROOT/stdout grepQuiet "Ignoring setting 'accept-flake-config' because experimental feature 'flakes' is not enabled" $TEST_ROOT/stderr # 'flakes' experimental-feature is enabled before, process diff --git a/tests/functional/flakes/config.sh b/tests/functional/flakes/config.sh index d1941a6be..f7eae06d8 100644 --- a/tests/functional/flakes/config.sh +++ b/tests/functional/flakes/config.sh @@ -28,6 +28,11 @@ nix build < /dev/null (! [[ -f post-hook-ran ]]) clearStore +# likewise with no-accept-flake-config +nix build --no-accept-flake-config +(! [[ -f post-hook-ran ]]) +clearStore + nix build --accept-flake-config test -f post-hook-ran || fail "The post hook should have ran" -- cgit v1.2.3