aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAlois Wohlschlager <alois1@gmx-topmail.de>2024-06-29 20:23:17 +0200
committerAlois Wohlschlager <alois1@gmx-topmail.de>2024-06-30 19:28:14 +0200
commita55112898e23df10a7a0d2a0cd359996100e3512 (patch)
treefbd58bf13294d34b780dacb3404a077718052c4c /tests
parent5dc85e8b72d1ba433f69200537146275ff1c4a03 (diff)
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 <lix@jade.fyi> Change-Id: I7ccd67a95bfc92cffc1ebdc972d243f5191cc1b4
Diffstat (limited to 'tests')
-rw-r--r--tests/functional/experimental-features.sh4
-rw-r--r--tests/functional/flakes/config.sh5
2 files changed, 7 insertions, 2 deletions
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"